[R] Primitives

Duncan Murdoch murdoch at stats.uwo.ca
Mon Apr 10 01:43:17 CEST 2006

On 4/9/2006 5:57 PM, Diethelm Wuertz wrote:
> Duncan Murdoch wrote:
>> On 4/9/2006 5:46 AM, Diethelm Wuertz wrote:
>>> How one can make a list of all functions in R's base
>>> package which are given as Primitives like abs, sqrt
>>> cumsum (but not log) ?
>> There's an is.primitive() test function; you just need to 
> Sorry when I ask again, how to list all functions in R's
> base installation?

ls(baseenv()) or ls("package:base")

will give you all their names.  So you need to use something like

names <- ls(baseenv())
result <- rep(FALSE, length(names))
for (i in seq(along=names)) {
   result[i] <- is.primitive(get(names[i], envir=baseenv()))

Duncan Murdoch

More information about the R-help mailing list