I'd like to get a dataframe with variable names, means, and standard deviations. For this purpose, I created the descriptives function:
library(tidyverse)
library(labelled)
data <- read_spss("http://staff.bath.ac.uk/pssiw/stats2/SAQ.sav")
descriptives <- function(data, var) {
data %>%
select({{var}}) %>%
drop_na() %>%
summarize(Label = labelled::var_label({{var}}), Mean = mean({{var}}), `Std Dev` = sd({{var}}))
}
descriptives(data, Q01)
I tried to map this function with all the variables Q01:Q23 but I'm getting this error: Error in is_quosure(x) : argument "x" is missing, with no default
data %>%
select(Q01:Q23) %>%
map_dfr(descriptives(data))