[R] Primitives
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Apr 10 08:09:49 CEST 2006
You need ls(all=TRUE) as some (12) are 'dot-names'. I just used
foo <- ls("package:base", all =TRUE)
pr <- foo[sapply(foo, function(x) is.primitive(get(x, "package:base")))]
and got 152.
There is a description in the `Writing R Extensions' manual, but it is
incomplete, and another classified list in tests/primitive-funs.R (also
incomplete).
On Sun, 9 Apr 2006, Duncan Murdoch wrote:
> 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()))
> }
> names[result]
>
> Duncan Murdoch
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list