I have a function that calculates the means of a grouped database for a column which is chosen based on the content of a variable VarName. The current function uses
VarName
Use !! with as.name or as.symbol:
!!
as.name
as.symbol
dat %>% group_by(Grade) %>% summarize(means = mean(!!as.name(VarName), na.rm=T)) # or summarize(means = mean(!!as.symbol(VarName), na.rm=T)) # A tibble: 2 x 2 # Grade means # #1 2.00 90.0 #2 3.00 77.5