diff --git a/DESCRIPTION b/DESCRIPTION index c0d32763..4aef11f4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.6.1.9042 -Date: 2019-05-29 +Version: 0.6.1.9043 +Date: 2019-05-30 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/R/age.R b/R/age.R index 26dbaa2a..bb9d4c10 100755 --- a/R/age.R +++ b/R/age.R @@ -107,7 +107,7 @@ age <- function(x, reference = Sys.Date()) { #' # resistance of ciprofloxacine per age group #' library(dplyr) #' septic_patients %>% -#' filter_first_isolate) %>% +#' filter_first_isolate() %>% #' filter(mo == as.mo("E. coli")) %>% #' group_by(age_group = age_groups(age)) %>% #' select(age_group, CIP) %>% diff --git a/R/ggplot_rsi.R b/R/ggplot_rsi.R index 126cb796..d312a4db 100755 --- a/R/ggplot_rsi.R +++ b/R/ggplot_rsi.R @@ -162,9 +162,9 @@ ggplot_rsi <- function(data, language = get_locale(), fun = count_df, nrow = NULL, - datalabels = TRUE, + datalabels = FALSE, datalabels.size = 3, - datalabels.colour = "grey15", + datalabels.colour = "white", ...) { stopifnot_installed_package("ggplot2") @@ -209,7 +209,7 @@ ggplot_rsi <- function(data, position <- "fill" } if (fun_name == "portion_df" - | (fun_name == "count_df" & position == "fill")) { + | (fun_name == "count_df" & identical(position, "fill"))) { # portions, so use y scale with percentage p <- p + scale_y_percent(breaks = breaks, limits = limits) } @@ -361,13 +361,13 @@ theme_rsi <- function() { labels_rsi_count <- function(position = NULL, x = "Antibiotic", datalabels.size = 3, - datalabels.colour = "grey15") { + datalabels.colour = "white") { stopifnot_installed_package("ggplot2") if (is.null(position)) { position <- "fill" } - if (position == "fill") { - position <- ggplot2::position_fill(vjust = 0.5) + if (identical(position, "fill")) { + position <- ggplot2::position_fill(vjust = 0.5, reverse = TRUE) } ggplot2::geom_text(mapping = ggplot2::aes_string(label = "lbl", x = x, diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index fde2caf9..9f20e05a 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@
diff --git a/docs/articles/index.html b/docs/articles/index.html index 6ff3241f..94f10ec0 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ diff --git a/docs/authors.html b/docs/authors.html index 002b35ca..8a1fd759 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ diff --git a/docs/index.html b/docs/index.html index 766ee653..e0e6061f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index fd7eb547..75e59ab8 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ diff --git a/docs/reference/age_groups.html b/docs/reference/age_groups.html index 5e25dba6..336945a7 100644 --- a/docs/reference/age_groups.html +++ b/docs/reference/age_groups.html @@ -80,7 +80,7 @@ @@ -291,38 +291,37 @@# NOT RUN { -ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21) +@@ -252,8 +252,8 @@ fill = "Interpretation", facet = NULL, breaks = seq(0, 1, 0.1), limits = NULL, translate_ab = "name", combine_SI = TRUE, combine_IR = FALSE, language = get_locale(), fun = count_df, - nrow = NULL, datalabels = TRUE, datalabels.size = 3, - datalabels.colour = "grey15", ...) + nrow = NULL, datalabels = FALSE, datalabels.size = 3, + datalabels.colour = "white", ...) geom_rsi(position = NULL, x = c("Antibiotic", "Interpretation"), fill = "Interpretation", translate_ab = "name", @@ -269,7 +269,7 @@ theme_rsi() labels_rsi_count(position = NULL, x = "Antibiotic", - datalabels.size = 3, datalabels.colour = "grey15") + datalabels.size = 3, datalabels.colour = "white")# NOT RUN { +ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21) -# split into 0-49 and 50+ -age_groups(ages, 50) +# split into 0-49 and 50+ +age_groups(ages, 50) -# split into 0-19, 20-49 and 50+ -age_groups(ages, c(20, 50)) +# split into 0-19, 20-49 and 50+ +age_groups(ages, c(20, 50)) -# split into groups of ten years -age_groups(ages, 1:10 * 10) -age_groups(ages, split_at = "tens") +# split into groups of ten years +age_groups(ages, 1:10 * 10) +age_groups(ages, split_at = "tens") -# split into groups of five years -age_groups(ages, 1:20 * 5) -age_groups(ages, split_at = "fives") +# split into groups of five years +age_groups(ages, 1:20 * 5) +age_groups(ages, split_at = "fives") -# split specifically for children -age_groups(ages, "children") -# same: -age_groups(ages, c(1, 2, 4, 6, 13, 17)) +# split specifically for children +age_groups(ages, "children") +# same: +age_groups(ages, c(1, 2, 4, 6, 13, 17)) -# resistance of ciprofloxacine per age group -library(dplyr) -septic_patients %>% - filter_first_isolate) %>% - filter(mo == as.mo("E. coli")) %>% - group_by(age_group = age_groups(age)) %>% - select(age_group, CIP) %>% - ggplot_rsi(x = "age_group") -# } -+# resistance of ciprofloxacine per age group +library(dplyr) +septic_patients %>% + filter_first_isolate() %>% + filter(mo == as.mo("E. coli")) %>% + group_by(age_group = age_groups(age)) %>% + select(age_group, CIP) %>% + ggplot_rsi(x = "age_group") +# }