[R] how to use do.call("rbind", get(list(mlist)))
Berton Gunter
gunter.berton at gene.com
Fri Jan 21 19:11:14 CET 2005
Roger:
Please re-read ?get, where it says that the x argument must be a single
character string name, not a list.You must first create the list using get
and then call do.call on that list:
do.call("rbind",lapply(mlist,get))
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of roger bos
> Sent: Friday, January 21, 2005 9:07 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] how to use do.call("rbind", get(list(mlist)))
>
> 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)))
>
> 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