library("cranlogs")
library("tidyverse")
library(dplyr)
library(ggthemes)
library(ggplot2)
library(plotly)
# Lets visualise how much packages was downloaded for past 4 years.
R_package <- cran_downloads(from = "2014-12-31",to = "2018-12-31")
glimpse(R_package)
## Observations: 1,462
## Variables: 2
## $ date <date> 2014-12-31, 2015-01-01, 2015-01-02, 2015-01-03, 2015-01...
## $ count <dbl> 114020, 62324, 143301, 127092, 130334, 219073, 235962, 2...
R_package$date <- R_package$date %>% cut(breaks = "month") %>% as.Date()
# ... create a summary for the whole month
R_package <- R_package %>% group_by(date) %>% summarize(Number = sum(count))
# draw a plot
p <- ggplot(R_package,aes(x = date,y = Number)) +
geom_point(color = "black", alpha = 0.8) +
geom_line(color = "blue",alpha = 0.8) +
geom_smooth(color = "green",method = "loess",se = FALSE) +
ggtitle("Monthly R packages downloads")+
theme_fivethirtyeight()
ggplotly(p)