-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
56 lines (47 loc) · 1.94 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: "{ggcharts} CRAN Downloads"
output: github_document
---
```{r knit_opts, include=FALSE}
knitr::opts_chunk$set(
message = FALSE,
warning = FALSE,
fig.path = "man/figures/README-",
fig.width = 12,
fig.height = 10
)
Sys.setlocale("LC_TIME", "English")
```
This repo contains the analysis of downloads of my [`ggcharts`](https://thomas-neitmann.github.io/ggcharts/index.html) `R` package. Following the ["analyses as package"](https://rmflight.github.io/posts/2014/07/analyses_as_packages.html) philosophy this repo itself is an `R` package that can installed using `remotes::install_github()`.
Why did I bother to make this a package? Because it forced me to modularize my code rather than having one long script. Almost all functions I use below are part of this package.
While I analyze `ggcharts` here, the function are written in a way that you can analyze any CRAN package.
This file was last updated on `r format(Sys.Date(), "%B %d, %Y")`.
```{r setup, results='hide'}
library(ggchartsdownloads)
library(ggplot2)
library(patchwork)
```
```{r analysis}
start_date <- as.Date("2020-03-26")
end_date <- Sys.Date() - 2
downloads <- download_logs("ggcharts", start_date, end_date)
daily_downloads <- compute_daily_downloads(downloads)
downloads_by_country <- compute_downloads_by_country(downloads)
p1 <- plot_daily_downloads(daily_downloads)
p2 <- plot_cumulative_downloads(daily_downloads)
p3 <- hist_daily_downloads(daily_downloads)
p4 <- plot_downloads_by_country(downloads_by_country)
f <- function(date) format(date, "%b %d, %Y")
patchwork_theme <- theme_classic(base_size = 24) +
theme(
plot.title = element_text(face = "bold"),
plot.caption = element_text(size = 14)
)
p1 + p2 + p3 + p4 +
plot_annotation(
title = "ggcharts is on the Rise",
subtitle = "A Summary of Downloads from the RStudio CRAN Mirror",
caption = glue::glue("Source: RStudio CRAN Logs ({f(start_date)} to {f(end_date)})"),
theme = patchwork_theme
)
```