0

There is a lot of stuff out there about how to do this (eg here and the dplyr vignette), but I can't understand much of it nor make any of it work.

If I want a quick summary of data I can accomplish this easily via

d <- data.frame(g = rep(c("A", "B"),10), vNom = rnorm(20,0,1))

(dTab <- d %>% group_by(g) %>% summarise(m = mean(vNom)))

I need to be able to get the same result with a character string, using either:

dTab <- d %>% group_by(g) %>% summarise(m = mean("vNom"))

or

dTab <- d %>% group_by(g) %>% summarise_(m = mean("vNom"))

But, of course neither work. I won't go through the dizzying array of !!, UQ, and quo()operators I have tried. It seems like such a simple task.

llewmills
  • 2,959
  • 3
  • 31
  • 58

0 Answers0