[R] Alternatives to rbind()

jim holtman jholtman at gmail.com
Sun Aug 2 23:25:24 CEST 2009


How are you creating the dataframes?  You did not provide an example
of the code.  Can you use 'lapply' instead of a 'for' loop and then
use 'do.call(rbind, lappy_result)' to create your dataframe?  Adding
each time through the loop can get resource consuming if the
dataframes are large, but you gave no idea of what you are trying to
process or how large it is.

On Sun, Aug 2, 2009 at 4:59 PM, Paulo Google<pauloeducardoso at gmail.com> wrote:
> I'm not sure if there are better methods to create objects such as
> dataframes with other than rbind function.
> II usually combine a data.frames created at each loop with a rbind(),
> specially when I don't know the dimension of the data.frame that will be
> created.
>
> Binding the new to an existing data.frame seems to be the easiest way to
> build an object that assemble data in a loop.
>
> Nevertheless, rbind seems to be much slower than filling rows of a previous
> created object but I don't know how this could be done in all situations,
> specially when the number of rows of the created object may vary at each
> loop.
>
> Any idea of alternatives to rbind?
>
> _______________
> Paulo E. Cardoso
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list