[Rd] Re: [R] Writing lgrindefs

Friedrich Leisch Friedrich.Leisch@ci.tuwien.ac.at
Thu, 27 Apr 2000 16:09:00 +0200 (CEST)


>>>>> On Thu, 27 Apr 2000 15:16:10 +0200 (MET DST),
>>>>> Kjetil Kjernsmo (KK) wrote:

KK> On Thu, 27 Apr 2000, Uwe Ligges wrote:
>>> however, having all the functions defined in base highlighted as keywords.
>>> Would that be a good idea, and if it is, how can I extract the function
>>> names most easily?
>> 
>> 1. You get a list of objects (not only functions!!!) by typing
>> ls(env=environment("R_GlobalEnv"))
>> 
>> 2. In the html-help files, e.g. the "Functions" index could help you.
>> Attention: Not only functions are listed here!


Finding out what is a function and what not is easy:

R> x<- ls("package:base")
R> x[40]
[1] ".lib.loc"
R> x[140]
[1] "anovalist.lm"

where the first is a vector and the second a function, which can
easily be traced:

R> sapply(x[c(40,140)],function(y){is.function(get(y))})
    .lib.loc anovalist.lm 
       FALSE         TRUE 

(don't know if this is the most elegant way of doing it). This leaves
all operators in the list as they are only functions allowing a
special syntax, hence if you want only ordinary functions, you could
simply discard those not starting with a dot or a letter.

Hope this helps,
Fritz

-- 
-------------------------------------------------------------------
                        Friedrich  Leisch 
Institut für Statistik                     Tel: (+43 1) 58801 10715
Technische Universität Wien                Fax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071      Friedrich.Leisch@ci.tuwien.ac.at
A-1040 Wien, Austria             http://www.ci.tuwien.ac.at/~leisch
     PGP public key http://www.ci.tuwien.ac.at/~leisch/pgp.key
-------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._