[R] How to assess object names within a function in lapply or l_ply?
Heinz Tuechler
tuechler at gmx.at
Mon Sep 28 18:53:57 CEST 2009
At 18:17 28.09.2009, hadley wickham wrote:
> > many thanks for your answer and for the enormous work you put into plyr, a
> > really powerful package.
> > For now, I will solve my problem with a variable label attribute, I usually
> > attach to columns in data frames. I asked the list, because I thought, I am
> > overlooking something trivial, since lapply itself apparently "knows" the
> > object names, as it labels the output by them. It just does not supply them
> > to the function it calls.
>
>lapply knows the names - the calling function doesn't - it takes the
>output add then fixes up the names after it's run.
>
>Hadley
A theoretical question, as you are not responsible for lapply: would
you think that problems arise, if lapply would name each list object
with it's name as it calls the function in it's body, instead of
naming it "X[[1L]]", ... ?
Heinz
>--
>http://had.co.nz/
More information about the R-help
mailing list