I want to use dplyr's new across syntax with a list of functions removing NAs.
This removes NAs, but I don't know how to do multiple functions at a time without rewriting.
library(tidyverse)
iris$Sepal.Length[1] <- NA #Creating an NA
iris %>%
group_by(Species) %>%
summarise(across(c(Sepal.Length:Petal.Width), ~ mean(.x, na.rm = TRUE)))
This does multiple functions at a time, but I don't know how to modify it to remove NAs.
iris %>%
group_by(Species) %>%
summarise(across(c(Sepal.Length:Petal.Width), list(mean = mean, sd = sd)))