Running examples in ‘AMR-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: age_groups
> ### Title: Split ages into age groups
> ### Aliases: age_groups
> ### Keywords: age age_group
> 
> ### ** Examples
> 
> ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
> 
> # split into 0-49 and 50+
> age_groups(ages, 50)
[1] 0-49 0-49 0-49 50+  0-49 50+  50+  0-49 0-49
Levels: 0-49 < 50+
> 
> # split into 0-19, 20-49 and 50+
> age_groups(ages, c(20, 50))
[1] 0-19  0-19  0-19  50+   20-49 50+   50+   20-49 20-49
Levels: 0-19 < 20-49 < 50+
> 
> # split into groups of ten years
> age_groups(ages, 1:12 * 10)
[1] 0-9     0-9     10-19   50-59   30-39   70-79   100-109 40-49   20-29  
13 Levels: 0-9 < 10-19 < 20-29 < 30-39 < 40-49 < 50-59 < 60-69 < ... < 120+
> age_groups(ages, split_at = "tens")
[1] 0-9     0-9     10-19   50-59   30-39   70-79   100-109 40-49   20-29  
13 Levels: 0-9 < 10-19 < 20-29 < 30-39 < 40-49 < 50-59 < 60-69 < ... < 120+
> 
> # split into groups of five years
> age_groups(ages, 1:24 * 5)
[1] 0-4     5-9     15-19   50-54   30-34   75-79   100-104 40-44   20-24  
25 Levels: 0-4 < 5-9 < 10-14 < 15-19 < 20-24 < 25-29 < 30-34 < ... < 120+
> age_groups(ages, split_at = "fives")
[1] 0-4     5-9     15-19   50-54   30-34   75-79   100-104 40-44   20-24  
25 Levels: 0-4 < 5-9 < 10-14 < 15-19 < 20-24 < 25-29 < 30-34 < ... < 120+
> 
> # split specifically for children
> age_groups(ages, "children")
[1] 2-3   6-12  13-17 18+   18+   18+   18+   18+   18+  
Levels: 0 < 1 < 2-3 < 4-5 < 6-12 < 13-17 < 18+
> # same:
> age_groups(ages, c(1, 2, 4, 6, 13, 17))
[1] 2-3   6-12  13-16 17+   17+   17+   17+   17+   17+  
Levels: 0 < 1 < 2-3 < 4-5 < 6-12 < 13-16 < 17+
> 
> # resistance of ciprofloxacine per age group
> library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

> septic_patients %>%
+   mutate(first_isolate = first_isolate(.)) %>%
+   filter(first_isolate == TRUE,
+          mo == as.mo("E. coli")) %>%
+   group_by(age_group = age_groups(age)) %>%
+   select(age_group,
+          cipr) %>%
+   ggplot_rsi(x = "age_group")
NOTE: Using column `mo` as input for `col_mo`.
NOTE: Using column `date` as input for `col_date`.
NOTE: Using column `patient_id` as input for `col_patient_id`.
=> Found 1,274 first isolates (65.5% within scope and 63.7% of total)
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... push.vp.vpTree -> push.vp -> push.vp.viewport -> grid.Call.graphics
Execution halted