I can't figure out what the underscore-based function is for the group_by_() function.
From the group_by help:
by_cyl <- group_by(mtcars, cyl)
summarise(by_cyl, mean(disp), mean(hp))
yields the expected:
Source: local data frame [3 x 3]
cyl mean(disp) mean(hp)
1 4 105.1364 82.63636
2 6 183.3143 122.28571
3 8 353.1000 209.21429
but this:
by_cyl <- group_by_(mtcars, cyl)
yields an error:
"Error in as.lazy_dots(list(...)) : object 'cyl' not found"
So my question is what does the underscore version do? And also, under what circumstances would I want to use it, rather than the "regular" one?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…