Here is a toy example:
df <- data.frame(user=c('a','b'), rating=c(1,2), age=c(17,33))
rating <- function(df, var){x <- df %>% summarise(sum(var))}
rating(df,age)
When I execute the function, I get the following error:
Error in summarise_impl(.data, dots) : object 'age' not found
How to pass a column name as parameter to the function?