# packages
suppressPackageStartupMessages(library(plotly))
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(tictoc))
suppressPackageStartupMessages(library(XML))
suppressPackageStartupMessages(library(RCurl))
suppressPackageStartupMessages(library(rlist))
suppressPackageStartupMessages(library(tidyverse))
# import
theurl <- RCurl::getURL("https://cran.r-project.org/web/packages/available_packages_by_date.html",.opts = list(ssl.verifypeer = FALSE) )
tables <- XML::readHTMLTable(theurl)
tables <- rlist::list.clean(tables,
fun = is.null,
recursive = FALSE)
n.rows <- unlist(lapply(tables,
function(t) dim(t)[1]))
df0 <- tables[[which.max(n.rows)]]
df1 <- janitor::clean_names(df0)
df1$date <- lubridate::ymd(df1$date)
df1$year <- lubridate::year(df1$date)
df1$month <- lubridate::month(df1$date)
df2 <- df1 %>%
group_by(date) %>%
count() %>%
ungroup()
# Make zoo object of data
temp.zoo <- zoo::zoo(df2$n, df2$date)
m.av <- zoo::rollmean(temp.zoo, 7,fill = list(NA, NULL, NA))
df2$moving_average <- zoo::coredata(m.av)
# filter to 2018+
df3 <- df2 %>%
filter(date > "2017-12-31")
# get rid of missing values at the end of the data set
df4 <- df3 %>% filter(!is.na(moving_average))
ggplot(df4, aes(date, n)) +
geom_line(aes(date, moving_average),color="red") +
xlab("date") + ylab("Daily Submissions")+
ggtitle("This is the title...") +
labs(title = "CRAN Package Submissions 2018+",
subtitle = "Seven Day Rolling Average.") +
theme(axis.title = element_text(size = 20),
axis.text = element_text(size = 20),
axis.text.x = element_text(size = 20),
plot.title = element_text(size = 19),
panel.background = element_rect(fill = NA)) +
labs(x = "Date.", caption = "Source: https://cran.r-project.org/web/packages/available_packages_by_date.html @superboreen")

Reproducibility.
Reproducibility Receipt.
# datetime
Sys.time()
## [1] "2021-10-25 09:08:30 IST"
# session info
sessionInfo()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.1 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
##
## locale:
## [1] LC_CTYPE=en_IE.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_IE.UTF-8 LC_COLLATE=en_IE.UTF-8
## [5] LC_MONETARY=en_IE.UTF-8 LC_MESSAGES=en_IE.UTF-8
## [7] LC_PAPER=en_IE.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_IE.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.7 purrr_0.3.4
## [5] readr_2.0.2 tidyr_1.1.4 tibble_3.1.5 tidyverse_1.3.1
## [9] rlist_0.4.6.2 RCurl_1.98-1.5 XML_3.99-0.8 tictoc_1.0.1
## [13] lubridate_1.8.0 plotly_4.10.0 ggplot2_3.3.5
##
## loaded via a namespace (and not attached):
## [1] httr_1.4.2 sass_0.4.0 jsonlite_1.7.2 viridisLite_0.4.0
## [5] modelr_0.1.8 bslib_0.3.1 assertthat_0.2.1 highr_0.9
## [9] cellranger_1.1.0 yaml_2.2.1 pillar_1.6.4 backports_1.2.1
## [13] lattice_0.20-41 glue_1.4.2 digest_0.6.28 rvest_1.0.2
## [17] snakecase_0.11.0 colorspace_2.0-2 htmltools_0.5.2 pkgconfig_2.0.3
## [21] broom_0.7.9 haven_2.4.3 scales_1.1.1 tzdb_0.1.2
## [25] generics_0.1.0 farver_2.1.0 ellipsis_0.3.2 withr_2.4.2
## [29] janitor_2.1.0 lazyeval_0.2.2 cli_3.0.1 magrittr_2.0.1
## [33] crayon_1.4.1 readxl_1.3.1 evaluate_0.14 fs_1.5.0
## [37] fansi_0.5.0 xml2_1.3.2 tools_4.1.0 data.table_1.14.2
## [41] hms_1.1.1 lifecycle_1.0.1 munsell_0.5.0 reprex_2.0.1
## [45] compiler_4.1.0 jquerylib_0.1.4 rlang_0.4.12 grid_4.1.0
## [49] rstudioapi_0.13 htmlwidgets_1.5.4 bitops_1.0-7 labeling_0.4.2
## [53] rmarkdown_2.11 gtable_0.3.0 DBI_1.1.1 R6_2.5.1
## [57] zoo_1.8-9 knitr_1.36 fastmap_1.1.0 utf8_1.2.2
## [61] stringi_1.7.5 Rcpp_1.0.7 vctrs_0.3.8 dbplyr_2.1.1
## [65] tidyselect_1.1.1 xfun_0.27
End.