Primitive Functions List

February 1, 2020
By

[This article was first published on Random R Ramblings, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Ever wondered which R functions are actually passed to internal C code? Well, wonder no more as it turns out there is an unexported named list within the methods package providing instructions for turning builtin and special functions into generic functions. Wrapping this list with names() gives us the list of all R functions which wrap calls to .Primitive().

names(methods:::.BasicFunsList)
#   [1] "$"                    "$<-"                  "["                   
#   [4] "[<-"                  "[["                   "[[<-"                
#   [7] "%*%"                  "xtfrm"                "c"                   
#  [10] "all"                  "any"                  "sum"                 
#  [13] "prod"                 "max"                  "min"                 
#  [16] "range"                "is.matrix"            ">="                  
#  [19] "cosh"                 "cummax"               "dimnames<-"          
#  [22] "as.raw"               "log2"                 "tan"                 
#  [25] "dim"                  "as.logical"           "^"                   
#  [28] "is.finite"            "sinh"                 "log10"               
#  [31] "as.numeric"           "dim<-"                "is.array"            
#  [34] "tanpi"                "gamma"                "atan"                
#  [37] "as.integer"           "Arg"                  "signif"              
#  [40] "cumprod"              "cos"                  "length"              
#  [43] "!="                   "digamma"              "exp"                 
#  [46] "floor"                "acos"                 "seq.int"             
#  [49] "abs"                  "length<-"             "sqrt"                
#  [52] "!"                    "acosh"                "is.nan"              
#  [55] "Re"                   "tanh"                 "names"               
#  [58] "cospi"                "&"                    "anyNA"               
#  [61] "trunc"                "cummin"               "levels<-"            
#  [64] "*"                    "Mod"                  "|"                   
#  [67] "names<-"              "+"                    "log"                 
#  [70] "lgamma"               "as.complex"           "asinh"               
#  [73] "-"                    "sin"                  "/"                   
#  [76] "as.environment"       "<="                   "as.double"           
#  [79] "is.infinite"          "is.numeric"           "rep"                 
#  [82] "round"                "sinpi"                "dimnames"            
#  [85] "asin"                 "as.character"         "%/%"                 
#  [88] "is.na"                "<"                    ">"                   
#  [91] "Im"                   "%%"                   "trigamma"            
#  [94] "=="                   "cumsum"               "atanh"               
#  [97] "sign"                 "ceiling"              "Conj"                
# [100] "as.call"              "log1p"                "expm1"               
# [103] "("                    ":"                    "="                   
# [106] "@"                    "{"                    "~"                   
# [109] "&&"                   ".C"                   "baseenv"             
# [112] "quote"                "<-"                   "is.name"             
# [115] "if"                   "||"                   "attr<-"              
# [118] "untracemem"           ".cache_class"         "substitute"          
# [121] "interactive"          "is.call"              "switch"              
# [124] "function"             "is.single"            "is.null"             
# [127] "is.language"          "is.pairlist"          ".External.graphics"  
# [130] "globalenv"            "class<-"              ".Primitive"          
# [133] "is.logical"           "enc2utf8"             "UseMethod"           
# [136] ".subset"              "proc.time"            "enc2native"          
# [139] "repeat"               "<<-"                  "@<-"                 
# [142] "missing"              "nargs"                "isS4"                
# [145] ".isMethodsDispatchOn" "forceAndCall"         ".primTrace"          
# [148] "storage.mode<-"       ".Call"                "unclass"             
# [151] "gc.time"              ".subset2"             "environment<-"       
# [154] "emptyenv"             "seq_len"              ".External2"          
# [157] "is.symbol"            "class"                "on.exit"             
# [160] "is.raw"               "for"                  "is.complex"          
# [163] "list"                 "invisible"            "is.character"        
# [166] "oldClass<-"           "is.environment"       "attributes"          
# [169] "break"                "return"               "attr"                
# [172] "tracemem"             "next"                 ".Call.graphics"      
# [175] "standardGeneric"      "is.atomic"            "retracemem"          
# [178] "expression"           "is.expression"        "call"                
# [181] "is.object"            "pos.to.env"           "attributes<-"        
# [184] ".primUntrace"         "...length"            ".External"           
# [187] "oldClass"             ".Internal"            ".Fortran"            
# [190] "browser"              "is.double"            "while"               
# [193] "nzchar"               "is.list"              "lazyLoadDBfetch"     
# [196] "...elt"               "is.integer"           "is.function"         
# [199] "is.recursive"         "seq_along"            "unlist"              
# [202] "as.vector"            "lengths"

To leave a comment for the author, please follow the link and comment on their blog: Random R Ramblings.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)