Is there a way to instruct dplyr to use summarise_each with na.rm=TRUE? I would like to take the mean of variables with summarise_each("mean") but I don't know how to specify it to ignore missing values.
dplyr
summarise_each
na.rm=TRUE
summarise_each("mean")
Following the links in the doc, it seems you can use funs(mean(., na.rm = TRUE)):
funs(mean(., na.rm = TRUE))
library(dplyr) by_species <- iris %>% group_by(Species) by_species %>% summarise_each(funs(mean(., na.rm = TRUE)))
2.1m questions
2.1m answers
60 comments
57.0k users