Re: [R] R demos

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Sat 25 Jun 2005 - 01:13:36 EST

On 6/24/2005 10:38 AM, Federico Calboli wrote:
> Hi All,
>
> I am currently preparing some form of slideshow introducing R and its
> capabilities for some colleagues. The thing will be about 30 mins, and
> I'd like to have some "pretty pictures" and some "amazing facts" (I'm
> trying to sell, obviously :)).
>
> Can I ask if it's possible to easily retrieve a gross figure of the
> number of functions in R considering the "base" install and all the
> libraries available?

I think it depends on what you mean by "all the libraries". If you mean   all the contributed packages on CRAN, then one way to get something along those lines is to look at the index.txt file in R_HOME/doc/html/search. It lists one entry per help topic in whatever packages you have installed. Help topics often document more than one function, and sometimes document data or other non-functions, so this isn't exactly what you were asking for.

If you really want the number of functions, you could do the following.

 > sapply(library()$results[,1], library, character.only=TRUE)

This attaches all installed packages.

 > apropos('.*', mode='function')

This gives the list of all functions on the search list. I get 3011 in R-patched with the base and recommended packages. I can't do it in a copy that has most of CRAN and Bioconductor loaded, because after attaching about 190 packages, library() dies with an error "Maximal number of DLLs reached.." At that point it's finding around 9600 functions. (The number of topics in index.txt was 14768.)

Duncan Murdoch



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 25 01:16:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:02 EST