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)))
1.4m articles
1.4m replys
5 comments
57.0k users