Dear Stephan,

Here is a suggestion using do.call():

res <- do.call(cbind, yourlist)
res

HTH,
Jorge


On Thu, Nov 19, 2009 at 10:03 AM, Stephan Dlugosz <> wrote:

> Hi!
>
> I have a data.frame "data" and splitted it.
>
> data <- split(data, data[,1])
>
> This is a quite slow procedure; and I do not want to do it again. So, any
> unsplit and "resplit" is no option for me.
> But: I have to cbind "variables" to the splitted data from another list,
> that contains of vectors with matching sizes, so
>
> for (i in 1:length(data)) {
>  data[[i]] <- cbind(data[[i]], l[[i]]))
> }
>
> works well; but very, very slowly.
> The lapply solution:
>
> data <- lapply(1:k, function(i) cbind(data[[i]], l[[i]]))
>
> does not improve the situation, but allows for mclapply from the multicore
> package...
> Is there a more efficient way to combine elements from two lists?
>
> Thank you very much!
>
> Greetings,
> Stephan
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to