age_groups fix

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-12-16 09:50:14 +01:00
parent 2018d5b477
commit bd5f46d734
1 changed files with 2 additions and 0 deletions

View File

@ -90,6 +90,7 @@ age <- function(x, y = Sys.Date()) {
#' age_groups(ages, "children")
#'
#' # resistance of ciprofloxacine per age group
#' library(dplyr)
#' septic_patients %>%
#' mutate(first_isolate = first_isolate(.)) %>%
#' filter(first_isolate == TRUE,
@ -100,6 +101,7 @@ age <- function(x, y = Sys.Date()) {
#' ggplot_rsi(x = "age_group")
age_groups <- function(x, split_at = c(12, 25, 55, 75)) {
if (is.character(split_at)) {
split_at <- split_at[1]
if (split_at %like% "^child") {
split_at <- c(0, 1, 2, 4, 6, 13, 18)
}