The top 5 R functions

December 9, 2009
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

John Myles White (who did the Canabalt scores analysis from last month) was trying to decide which R functions to spend time learning, and asked the obvious followup question: Which functions in R are used the most? With no readily-available answer, John answered the question himself, by counting the number of times each function is called in all the packages available on CRAN. He then ranked the functions in two ways: first, by the total number of times each function is called in all the source code for all the packages, and then by counting the number of packages that use each function at least once. The top five functions are therefore:

  • if
  • c
  • function
  • length
  • list (by the number of packages) or paste (by number of uses)

The order varies by the method used, and technically "if" and "function" are keywords, not functions. But John has helpfully provided the data in CSV format for both the package method and total uses method, so you can do your own analysis. Also interesting to note is that the occurrences table is another example of the power-law distribution in action.

R_log_frequencies1

 John Myles White: R Function Usage Frequencies (Take 2)

To leave a comment for the author, please follow the link and comment on his blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags:

Comments are closed.