Skip to content
Back to formatted view

Raw Message

Message-ID: <20090315132308.17564f1e@absentia>
Date: 2009-03-15T05:23:08Z
From: Berwin A Turlach
Subject: primitives again
In-Reply-To: <2d1ebb110903142052y47da9865m294bff433fb5c22e@mail.gmail.com>

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