Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Jul 9, 2024
1 parent 23c59ce commit d60c622
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
},
"isPartOf": "http://ropengov.org/",
"keywords": ["ropengov", "template", "r", "r-package", "github-actions", "pkgdown", "pkgdown-template"],
"fileSize": "631.176KB",
"fileSize": "631.158KB",
"releaseNotes": "https://github.com/rOpenGov/rogtemplate/blob/master/NEWS.md",
"readme": "https://github.com/rOpenGov/rogtemplate/blob/main/README.md",
"contIntegration": "https://github.com/rOpenGov/rogtemplate/actions",
Expand Down
1 change: 1 addition & 0 deletions inst/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ navbar:
template:
bootstrap: 5
theme: tango
math-rendering: katex
bslib:
base_font: "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'"
code_font: "Roboto Mono"
Expand Down
43 changes: 26 additions & 17 deletions vignettes/articles/downloads.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,7 @@ dwn <- lapply(mypaks, cranlogs::cran_downloads, from = "2016-01-01")
dwn <- dwn %>%
bind_rows() %>%
tidyr::drop_na() %>%
filter(count > 0)
# By month
library(lubridate)
dwn_m <- dwn %>%
mutate(m = lubridate::ceiling_date(dwn$date, "month") - 1) %>%
group_by(package, m) %>%
summarise(downloads = sum(count))
as_tibble()
# First date on CRAN
Expand All @@ -84,6 +73,25 @@ first_date_on_cran <- function(pkg) {
fechas <- lapply(unique(dwn$package), first_date_on_cran) %>%
bind_rows()
dwn <- dwn %>%
left_join(fechas %>% select(package, d_cran = date)) %>%
filter(date >= d_cran) %>%
select(-d_cran) %>%
tidyr::replace_na(list(count = 0)) %>%
filter(date < Sys.Date())
# By month
library(lubridate)
dwn_m <- dwn %>%
mutate(m = lubridate::ceiling_date(dwn$date, "month") - 1) %>%
group_by(package, m) %>%
summarise(downloads = sum(count))
# factors by first date on CRAN
fact <- fechas %>%
arrange(date) %>%
Expand All @@ -96,7 +104,7 @@ dwn_m$package <- factor(dwn_m$package, levels = unique(fact))

### Historic

```{r echo=FALSE}
```{r echo=FALSE, fig.alt="Monthly downloads of packages hosted by rOpenGov"}
tot <- dwn_m %>%
group_by(m) %>%
summarise(ntot = sum(downloads))
Expand All @@ -119,7 +127,7 @@ ggplot(dwn_m, aes(x = m)) +

### Weekly downloads

```{r echo=FALSE, fig.asp=1.5}
```{r echo=FALSE, fig.asp=1.5, fig.alt="Weekly downloads of packages hosted by rOpenGov"}
dwn_w <- dwn %>%
filter(date >= (Sys.Date() - years(1))) %>%
mutate(m = lubridate::ceiling_date(date, "week")) %>%
Expand Down Expand Up @@ -172,15 +180,16 @@ lastweek <- dwn %>%
summarise(last_week = sum(count, na.rm = TRUE))
last_day <- dwn %>%
filter(date == max(dwn$date, na.rm = TRUE)) %>%
filter(date == max(dwn$date, na.rm = TRUE) - 1) %>%
select(package, last_day = count)
avg_daily <- dwn %>%
group_by(package) %>%
summarise(avg = round(mean(count, na.rm = TRUE), 1))
avg_daily_all <- dwn %>%
summarise(avg = round(mean(count, na.rm = TRUE), 1))
avg_daily_all <- avg_daily %>%
ungroup() %>%
summarise(avg = round(sum(avg, na.rm = TRUE), 1))
# Une todo y da nombres
end <-
Expand Down
6 changes: 4 additions & 2 deletions vignettes/articles/ggplot2-example.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "ggplot2-example"
title: "ggplot2 example"
---

```{r, include = FALSE}
Expand All @@ -14,9 +14,11 @@ Example on a **ggplot2** image

```{r setup, fig.alt="A ggplot2 image", fig.cap="A ggplot2 image"}
library(ggplot2)
library(rogtemplate)
# counts (or sums of weights)
g <- ggplot(mpg, aes(class))
# Number of cars in each class:
g + geom_bar()
g + geom_bar(fill = rog_orange_pal(1))
```
Binary file modified vignettes/plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d60c622

Please sign in to comment.