# Ever wonder how popular your favorite R functions are?

March 7, 2014
By

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

How’s that fried pickle sandwich treating you?  Perhaps your taste in R  functions are less bizarre than your taste in R commands?

Now you can easily find out using this new shiny app!  In this post I use the R function frequency table compiled by John Myles White in 2009 in which he counts the occurrences of words in the source files of all CRAN packages.

I take his table and I modify it slightly to include a ranking system as well as a count of the number of characters in each function.  In this Shiny application you can see both frequencies of functions graphically for a user specified range as well as find within the frequency chart easily search by imputing function names.

Play with the shiny app!

https://econometricsbysimulation.shinyapps.io/FCount/
I before creating the shiny App I needed to work on the frequency data a bit:

First off get the CSV file provided by John Myles White:
http://www.johnmyleswhite.com/content/data_sets/r_function_frequencies.csv

`freqTable <- read.csv("r_function_frequencies.csv") freqTable<-freqTable[!is.na(freqTable[,1]),] # Let's look at the datahead(freqTable)freqTable <-freqTable[order(freqTable\$Call.Count, decreasing = T),] # Okay so we have over 27,000 words with some of them appearing as `
`# infrequently as 12 times.  Let's make the minimum 25 occurrences. # freqTable <- freqTable[freqTable\$Call.Count>=25,] # Convert the freqTable data from factors to lettersfreqTable[,1] <- as.character(freqTable[,1]) # When we rank the functions by occurance we have a total of 660 `
`# different levelsnumbers <- sort(unique(freqTable[,2]), decreasing=T)nrank <- 1:length(numbers) # This will create a ranking from 1 to length of unique frequenciesfor (i in numbers) freqTable\$rank[freqTable[,2]==i] <- nrank[i==numbers] # Create a number of characters vector to be added to the frequency tablefreqTable\$nchar <- nchar(freqTable[,1]) # Save the table for access in Shinysave(freqTable, file="freqTable.Rdata")`

Created by Pretty R at inside-R.org

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