Skip to content

Commit 2f820bb

Browse files
Merge pull request #8 from ukhsa-collaboration/crancomments-feb
Cran comments addressed
2 parents 2cc94e5 + eaae17b commit 2f820bb

20 files changed

+142
-1767
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
^\.Rproj\.user$
55
^LICENSE\.md$
66
^README\.Rmd$
7+
^README\.html$
78
^cran-comments\.md$
89
^pkgdown$
910
^_pkgdown\.yml$

DESCRIPTION

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ Authors@R:
1717
person(given="Frederick", family="Sloots", email="Frederick.Sloots@ukhsa.gov.uk", role = c("ctb")),
1818
person(given="Charlie", family="Turner", email="Charlie.Turner@ukhsa.gov.uk", role = c("ctb"))
1919
)
20-
Description: Tools for making epidemiological reporting easier with consistent static and dynamic charts and maps.
20+
Description: Tools for making epidemiological reporting easier with consistent
21+
static and dynamic charts and maps. Builds on 'ggplot2' for static
22+
visualizations as described in Wickham (2016) <doi:10.1007/978-3-319-24277-4>
23+
and 'plotly' for interactive visualizations as described in
24+
Sievert (2020) <doi:10.1201/9780429447273>.
2125
License: MIT + file LICENSE
2226
Encoding: UTF-8
2327
Roxygen: list(markdown = TRUE)
@@ -30,7 +34,8 @@ Suggests:
3034
withr,
3135
yarrr,
3236
knitr,
33-
rmarkdown
37+
rmarkdown,
38+
shiny
3439
Config/testthat/edition: 3
3540
Imports:
3641
grDevices,

NEWS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
## CRAN submission fixes
55

6-
* Added `on.exit()` calls to properly restore user options in `.onLoad()`
7-
* Replaced `\dontrun{}` with `\donttest{}` or unwrapped examples where appropriate
8-
* Resubmission addressing CRAN reviewer feedback
6+
* Added references to DESCRIPTION field (ggplot2 and plotly DOIs)
7+
* Replaced all `\dontrun{}` with `\donttest{}` in examples
8+
* Simplified examples to execute in < 5 seconds
9+
* Added `@seealso` references to vignettes for additional examples
10+
* Verified `on.exit()` is correctly used in `.onLoad()` for option changes
911

1012
# epiviz 0.1.1
1113

R/age_sex_pyramid.R

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,14 @@
5252
#' \donttest{
5353
#' # Example using a line list
5454
#' df <- epiviz::lab_data
55-
#' age_sex_pyramid(
55+
#' result <- age_sex_pyramid(
5656
#' dynamic = FALSE,
5757
#' params = list(
5858
#' df = df,
59-
#' var_map = list(age_var = 'age', dob_var = 'date_of_birth', sex_var = 'sex'),
59+
#' var_map = list(dob_var = 'date_of_birth', sex_var = 'sex'),
6060
#' grouped = FALSE
6161
#' )
6262
#' )
63-
#'
64-
#' # Example using pre-grouped data
65-
#' grouped_df <- data.frame(
66-
#' age_group = c("0-4", "5-18", "19-64", "65+"),
67-
#' sex = c("Male", "Female"),
68-
#' value = c(100, 120, 150, 80),
69-
#' ci_lower = c(90, 110, 140, 70),
70-
#' ci_upper = c(110, 130, 160, 90)
71-
#' )
72-
#' age_sex_pyramid(
73-
#' dynamic = FALSE,
74-
#' params = list(
75-
#' df = grouped_df,
76-
#' var_map = list(age_group_var = 'age_group', sex_var = 'sex', value = 'value'),
77-
#' grouped = TRUE
78-
#' )
79-
#' )
8063
#' }
8164
#'
8265
#' @import ggplot2
@@ -112,9 +95,6 @@ age_sex_pyramid <- function(
11295
)
11396
) {
11497

115-
# Solve warnings regarding font family not found using utils/set_Arial() function
116-
set_Arial()
117-
11898
# Where relevant, assign defaults to any parameters not specified by the user
11999
if(!exists('mf_colours',where=params)) params$mf_colours <- c("#440154", "#2196F3")
120100
if(!exists('x_breaks',where=params)) params$x_breaks <- 10
@@ -251,6 +231,9 @@ age_sex_pyramid <- function(
251231
}else{
252232
# plotly implementation of dynamic age-sex-pyramid
253233

234+
# Solve warnings regarding font family not found using utils/set_Arial() function
235+
set_Arial()
236+
254237
# Process data similarly to static version
255238
# plotly implementation of dynamic age-sex-pyramid
256239
var_map <- params$var_map
@@ -422,7 +405,7 @@ age_sex_pyramid <- function(
422405
linecolor = "black"
423406
),
424407
barmode = 'overlay',
425-
font = list(family = "Arial"),
408+
font = list(family = "sans"),
426409
hoverlabel = list(bgcolor = "white", font = list(size = 12)),
427410
showlegend = TRUE,
428411
legend = list(orientation = "h",

R/agesex_pyramid_grouped.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ agesex_pyramid_grouped <- function(df,
118118
# customisations to minimal theme
119119
theme(
120120
panel.grid = element_blank(),
121-
axis.title.y = element_text(family="Arial", margin = margin(0, 20, 0, 0, "mm"), face="bold"),
121+
axis.title.y = element_text(family="sans", margin = margin(0, 20, 0, 0, "mm"), face="bold"),
122122
axis.title.x = element_text(face="bold"),
123123
legend.position = "bottom",
124124
legend.title = element_blank(),
125-
text = element_text(size = text_size, family="Arial"),
126-
plot.title = element_text(hjust = 0.5, family="Arial"),
125+
text = element_text(size = text_size, family="sans"),
126+
plot.title = element_text(hjust = 0.5, family="sans"),
127127
plot.margin = margin(1, 1.2, 1, 1.2, "cm"),
128128
axis.line.x = element_line(color = "black"),
129129
axis.ticks.x = element_line(color = "black")

R/base_gg.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ base_gg <- function() {
1515

1616

1717
# Ensure that unused variables exist
18+
if(!exists("chart_font")) {chart_font <- "sans"}
1819
if(!exists("x_time_series")) {x_time_series <- FALSE}
1920
if(!exists("axis_flip")) {axis_flip <- FALSE}
2021

R/base_plotly.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ base_plotly <- function() {
1414

1515

1616
# Ensure that unused variables exist
17+
if(!exists("chart_font")) {chart_font <- "sans"}
1718
if(!exists("x_time_series")) {x_time_series <- FALSE}
1819
if(!exists("axis_flip")) {axis_flip <- FALSE}
1920

0 commit comments

Comments
 (0)