Introduction
This R
package queries download stats of R
packages.
For CRAN packages, it queries from RStudio download logs.
For Bioconductor packages, it queries from Bioconductor download stats.
Download stats of CRAN packages
library("ggplot2")
library("dlstats")
x <- cran_stats(c("emojifont", "ggimage", "hexSticker", "rvcheck"))
head(x)
## start end downloads package
## 1 2016-02-01 2016-02-29 42 emojifont
## 2 2016-03-01 2016-03-31 323 emojifont
## 3 2016-04-01 2016-04-30 257 emojifont
## 4 2016-05-01 2016-05-31 234 emojifont
## 5 2016-06-01 2016-06-30 212 emojifont
## 7 2016-07-01 2016-07-31 309 emojifont
ggplot(x, aes(end, downloads, group=package, color=package)) +
geom_line() + geom_point(aes(shape=package))
Download stats of Bioconductor packages
pkgs <- c("ChIPseeker", "clusterProfiler", "DOSE", "ggtree", "GOSemSim", "ReactomePA")
y <- bioc_stats(pkgs)
## Warning in file(file, "rt"): cannot open URL 'https://bioconductor.org/
## packages/stats/bioc/ChIPseeker/ChIPseeker_stats.tab': HTTP status was '404
## Not Found'
## Warning in FUN(X[[i]], ...): --> OMITTED: ChIPseeker download stats not
## found or currently not available...
## Warning in file(file, "rt"): cannot open URL 'https://bioconductor.org/
## packages/stats/bioc/clusterProfiler/clusterProfiler_stats.tab': HTTP status
## was '404 Not Found'
## Warning in FUN(X[[i]], ...): --> OMITTED: clusterProfiler download stats
## not found or currently not available...
## Warning in file(file, "rt"): cannot open URL 'https://bioconductor.org/
## packages/stats/bioc/DOSE/DOSE_stats.tab': HTTP status was '404 Not Found'
## Warning in FUN(X[[i]], ...): --> OMITTED: DOSE download stats not found or
## currently not available...
## Warning in file(file, "rt"): cannot open URL 'https://bioconductor.org/
## packages/stats/bioc/ggtree/ggtree_stats.tab': HTTP status was '404 Not
## Found'
## Warning in FUN(X[[i]], ...): --> OMITTED: ggtree download stats not found
## or currently not available...
## Warning in file(file, "rt"): cannot open URL 'https://bioconductor.org/
## packages/stats/bioc/GOSemSim/GOSemSim_stats.tab': HTTP status was '404 Not
## Found'
## Warning in FUN(X[[i]], ...): --> OMITTED: GOSemSim download stats not found
## or currently not available...
## Warning in file(file, "rt"): cannot open URL 'https://bioconductor.org/
## packages/stats/bioc/ReactomePA/ReactomePA_stats.tab': HTTP status was '404
## Not Found'
## Warning in FUN(X[[i]], ...): --> OMITTED: ReactomePA download stats not
## found or currently not available...
## NULL
if (!is.null(y)) {
ggplot(y, aes(end, Nb_of_downloads, group=package, color=package)) +
geom_line() + geom_point(aes(shape=package))
library("tidyr")
yy <- gather(y, type, Nb, Nb_of_distinct_IPs:Nb_of_downloads)
ggplot(yy, aes(end, Nb, shape=package, color=package)) +geom_point() + geom_line() +
ylab(NULL) + xlab(NULL) + facet_grid(type~., scales="free_y") +
ggtitle("Number of downloads per Month") +
scale_x_date(date_breaks="1 year", date_labels = "%Y")
}