This is the first of a three part blog post on charting and analysing the number of R package submissions.
(I will update this blog post with links to the other two posts as they come available)
I'm sure most of you have heard of the R programming language. If not then perhaps it is something that you might want to go off an learn a bit about. Why? well it is one of the most popular languages for performing various types of statistics, advanced topics on statistics and machine learning and for generating lots of cool looking graphs.
If this is not something that you might be interested then it is time to go to another website/blog.
In this blog post I'm going to chart the number of packages submitted to R and are available for download and installation.
Why am I doing this? I got bored one day after coming back from my vacation and I though it would be a useful thing to do. Then after doing this I decided to use these graphs somewhere else, but you will have to wait until 2016 to find out!
The R website has a listing of all the packages and the dates that they were submitted.
There are a variety of tools available that you can use to extract the information on this webpage and there are lots of examples or R code too. I'll leave that as a little exercise for you to do.
I extracted all of this information and stored it in a table in my Oracle Database (of course I did as I work with Oracle databases day in day out). This will allow me to easily reuse this data whenever I need it plus I can update this table with new packages from time to time.
The following R code:
- Setups up and ROracle connection to my schema in my database
- Connects to the database
- Setups up a query to extract the data from the table
- Fetches this data into an R data frame called data
- Reformat the date columns to remove the time element to it
- Plot the data
library(ROracle) drv <- dbDriver("Oracle") # Create the connection string host <- "localhost" port <- 1521 service <- "pdb12c" connect.string <- paste( "(DESCRIPTION=", "(ADDRESS=(PROTOCOL=tcp)(HOST=", host, ")(PORT=", port, "))", "(CONNECT_DATA=(SERVICE_NAME=", service, ")))", sep = "") con <- dbConnect(drv, username = "brendan", password = "brendan",dbname=connect.string) res<-dbSendQuery(con, "select r_date, count(*) r_num from r_packages group by r_date order by 1 asc") data <- fetch(res) rdate<- data$R_DATE rdate2<-as.Date(rdate,"%d/%m/%y") plot(data$R_NUM~rdate2, data, type="l" , xaxt="n") axis(1, rdate2, format(rdate2, "%b %y"), cex.axis=.7, las=1)
After I run the above code I get the following plot.
(Yes I could have done a better job on laying out the chart with all sorts of labels and colors etc)
This chart gives us a plot of the number of new submissions by day.
There are 2 very obvious things that stand out from this graph. The easiest one to deal with is that we can see that there has been substantical growth in new submissions over the past 3 years. Perhaps we need to examine these a bit closer and when you do you will find that a lot of these are existing packages that have been resubmitted with updates.
There is a very obvious peak just over half ways along the chart. We really need to investigate this to understand what has happended. This peak occurs on the 29th October 2012. What happened on the 29th October 2012 as this is clearly an anomaly with the rest of the data. Well on this date R version 2.15.2 was release and a there was a lot of update pagackes got resubmitted.
Check out my next two blog posts were I will explore this data in a bit more detail.