ddply run in a function looks in the environment outside the function?
问题 I'm trying to write a function to do some often repeated analysis, and one part of this is to count the number of groups and number of members within each group, so ddply to the rescue !, however, my code has a problem.... Here is some example data > dput(BGBottles) structure(list(Machine = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("1", "2", "3", "4"), class = "factor"), weight = c(14.23, 14.96, 14.85, 16.46, 16.74, 15.94, 14.98, 14.88, 14.87, 15.94, 16.07, 14.91