[R] tank you
ronggui
0034058 at fudan.edu.cn
Sun Jun 19 15:47:48 CEST 2005
thank you.
when i examined the ?split, i have figure out the answer.
still,thank you very much.and sorry for my igorance.
On Sun, 19 Jun 2005 09:41:38 -0400
"Liaw, Andy" <andy_liaw at merck.com> wrote:
> That's a call to the replacement function "split<-"(), which is defined as:
>
> > get("split<-.default")
> function (x, f, value)
> {
> ix <- split(seq(along = x), f)
> n <- length(value)
> j <- 0
> for (i in ix) {
> j <- j%%n + 1
> x[i] <- value[[j]]
> }
> x
> }
>
> Andy
>
> > From: ronggui
> >
> > 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
> >
> > ______________________________________________
> > R-help at 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
> >
> >
> >
>
>
>
> ------------------------------------------------------------------------------
> Notice: This e-mail message, together with any attachment...{{dropped}}
More information about the R-help
mailing list