Here is another way to do it using double bangs as a prefix to the variable and converting the data type to a df symbo
mtcars %>% select(var) %>% group_by(!! as.name(var)) %>% tally() #summarise(n