Re: [R] Applying rbind() to a sequence of data frame names

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Tue, 01 Apr 2008 13:15:44 -0300

Try this:

do.call(rbind, lapply(ls(patt="^ds[0-9]"), get))

On 01/04/2008, Hans W. Borchers <hwborchers_at_gmail.com> wrote:
> I have a set of data frames ds1, ds2, ... each having the same columns
> and column names:
>
> ds1 <- data.frame(x=c(1,2,3,4), y=c(5,6,7,8))
> ds1 <- data.frame(x=c(9,10,11,12), y=c(13,14,15,16))
> ...
>
> and I would like to combine them into just one data frame like
>
> ds <- rbind(ds1, ds2, ...)
>
> Because there are so many of them, I will have to use a character array
>
> nms <- c("ds1", "ds2", ...)
>
> How can I use this character array to generate a command using rbind()
> on all of these data frames at once.
>
> I tried to apply eval() somehow, but did not come up with the right idea.
>
> Thanks
>
> ______________________________________________
> 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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
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.
Received on Tue 01 Apr 2008 - 17:26:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Apr 2008 - 19:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive