1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 07:26:13 +01:00

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

View File

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