text: Q:
  
  Is there a a way to make this function calculate sd as well as mean?
  
  setNames(apply(cats, 1, , na.rm = TRUE), df[[1]])) 
  
  I would like mean and sd to be outputted by one function.
  
  A:
  
  Here is an option with dplyr
  library(dplyr)
  iris %>%
    summarise_at(vars(Sepal.Length), list(mean = ~mean(., na.rm = TRUE), 
           sd = ~sd(., na.rm = TRUE)))
  #      mean        sd
  #1 5.843333 0.8280661   
  
  