[R] what does this syntax mean?

ronggui 0034058 at fudan.edu.cn
Sun Jun 19 08:05:49 CEST 2005


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?

thank you!



-- 
Department of Sociology
Fudan University,Shanghai
Blog:http://sociology.yculblog.com




More information about the R-help mailing list