Displaying 1 result from an estimated 1 matches for "mergelistelem".
2004 May 20
2
for() to lapply()
...t of start merging.
result<-merge(LIST[[m]],LIST[[m+1]],by="key",all.x=T)
for (i in (m+2):length(LIST))
{
result<-merge(result,LIST[[i]],by="key",all.x=T)
}
The problem is the acumulative: "result<-merge(result,...)"
I can think in a function like this:
mergeListelem<-function(i,LS,m)
{
merge(LS[[m]],LS[[i]],by="key",all.x=T)
}
ind<-m:length(LIST)
lapply(ind,mergeListelem,LIST,m)
But I just obtain a list of merged data.frames,
and I don伮伌t know how to join all the elements
of the list in just one final data.frame.
Thank you for your help
-...