[R] R demos

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jun 24 17:13:36 CEST 2005

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

More information about the R-help mailing list