[R] primitives again
Berwin A Turlach
berwin at maths.uwa.edu.au
Sun Mar 15 06:23:08 CET 2009
G'day Edna,
On Sat, 14 Mar 2009 22:52:38 -0500
Edna Bell <edna.bell01 at gmail.com> wrote:
> Dear R Gurus:
Well, I guess I can answer nevertheless. :)
> How do I find the functions which are primitives, please?
?is.primitive
Thus, the following code would give you all the primitive functions in
package base:
R> pos <- "package:base"
R> uu <- ls(pos=pos, all=TRUE)
R> tt <- sapply(uu, function(x) is.primitive(get(x, pos=pos)))
R> rr <- uu[tt]
R> rr
You may want to search other packages too. Or modify the code such
that you loop over your search path and concatenate the results from
the various locations.
HTH.
Cheers,
Berwin
More information about the R-help
mailing list