[R] for() to lapply()
Jason Turner
jasont at indigoindustrial.co.nz
Fri May 21 02:43:56 CEST 2004
On Thu, May 20, 2004 at 03:52:22PM -0500, Kenneth Cabrera wrote:
> Hi dear R-users:
>
> I have the following problem:
> I have a list of data.frames (12 variables and 60000 rows, each)
>
> I have to merge from an specific point of the list to the
> end of the list, I am doing so with a for() loop but it is
> too inefficient and it exhausts memory.
>
> How can I convert this for() loop in a function and then use
> lapply?
There's still a better way to do it, I'm sure, but something
like...
##untested!
myMerge <- function(x,y,...) {
zz <- merge(x,y,...)
gc()
}
foo <- lapply(my.df.list[[-1]],myMerge,my.df.list[[1]])
Cheers
Jason
--
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz
More information about the R-help
mailing list