does the by( ) function make growing list
问题 Does the by function make a list that grows one element at a time? I need to process a data frame with about 4M observations grouped by a factor column. The situation is similar to the example below: > # Make 4M rows of data > x = data.frame(col1=1:4000000, col2=10000001:14000000) > # Make a factor > x[,"f"] = x[,"col1"] - x[,"col1"] %% 5 > > head(x) col1 col2 f 1 1 10000001 0 2 2 10000002 0 3 3 10000003 0 4 4 10000004 0 5 5 10000005 5 6 6 10000006 5 Now, a tapply on one of the columns takes