[R] how to use do.call("rbind", get(list(mlist)))
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri Jan 21 19:13:25 CET 2005
roger bos wrote:
> I have around 200 data frames I want to rbind in a vectorized way.
> The object names are:
>
> m302
> m303
> ...
> m500
>
> So I tried:
>
> mlist <- paste("m",302:500,sep="")
> dat <- do.call("rbind", get(list(mlist)))
do.call("rbind", lapply(mlist, get))
Uwe Ligges
> and I get "Error in get(x, envir, mode, inherits) : invalid first argument"
>
> I know "rbind" is valid because
>
> dat <- rbind(m302, m303, m304, m305)
>
> works, I am just too lazy to type it out to m500.
>
> I also tried it without the get() portion, but then dat ends up being
> a column with just the names of the objects, not the objects
> themselves.
>
> Thanks in advance for showing me the errors in my attempts.
>
> Roger
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list