ronggui wrote: > i study the code of function ave,but i can understand one line of the syntax. > > >>ave > > function (x, ..., FUN = mean) > { > n <- length(list(...)) > if (n) { > g <- interaction(...) > split(x, g) <- lapply(split(x, g), FUN) > } > else x[] <- FUN(x) > x > } > > my question is : what does "split(x, g) <- lapply(split(x, g), FUN)" mean?
See ?split and ?lapply. x is grouped by g, FUNis applied on each group and assigned back to the original values. Uwe Ligges > thank you! > > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html