Hi,
when trying to summarise median values by a categorical variable (here, cognitive_status) using the dplyr package, in some cases I get a error warning (for most of the variables it works fine!)
I'd appreciate some help,
Thanks!
dat %>%
group_by(cognitive_status) %>%
summarize(medn = median(dt_alph_gs, na.rm = T))
Error: Problem with summarise()
input medn
.
x Input medn
must return compatible vectors across groups
Result type for group 1 (cognitive_status = "No cognitive impairment"): .
Result type for group 2 (cognitive_status = "MCI"): .
Input medn
is median(dt_alph_gs, na.rm = T)
.