Ever wonder how popular your favorite R functions are?

[This article was first published on Econometrics by Simulation, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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/

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 data
head(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 letters
freqTable[,1] <- as.character(freqTable[,1])
 
# When we rank the functions by occurance we have a total of 660 
# different levels
numbers <- sort(unique(freqTable[,2]), decreasing=T)
nrank <- 1:length(numbers)
 
# This will create a ranking from 1 to length of unique frequencies
for (i in numbers) freqTable$rank[freqTable[,2]==i] <- nrank[i==numbers]
 
# Create a number of characters vector to be added to the frequency table
freqTable$nchar <- nchar(freqTable[,1])
 
# Save the table for access in Shiny
save(freqTable, file="freqTable.Rdata")

To leave a comment for the author, please follow the link and comment on their blog: Econometrics by Simulation.

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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)