-Usage
aggregate(x, by, FUN, ..., simplify = TRUE, drop = TRUE)
与tapply类似,但是x可以为data.frame或矩阵;
-Arguments
by
a list of grouping elements, each as long as the variables in the data frame x. The
elements are coerced to factors before use.
-Example





-Usage
by(data, INDICES, FUN, ..., simplify = TRUE);
-Example
将warpbreaks的一二列,根据tension这一列的(L、M、H)运行summary


aggregate与by的区别:aggregate是对x的每一列分别根据因子进行分组计算,而by是根据因子将data整个分成几个小的data.frame,然后进行运算;
网友评论