The top 5 R functions
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.
John Myles White: R Function Usage Frequencies (Take 2)
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.