[R] "renaming" dataframe1 using "column" names from dataframe2?

bogdan romocea br44114 at gmail.com
Fri Mar 17 17:56:06 CET 2006

?assign, but _don't_ use it; lists are better.
dfr <- list()
for(j in 1:9) {
  dfr[[as.character(j)]] <- ...
Don't try to imitate the limited macro approach of other software
(e.g. SAS). You can do all that in R, but it's much simpler and much
safer to rely on list indexing and functions that return values
(rather than create objects).

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of r user
> Sent: Friday, March 17, 2006 10:26 AM
> To: rhelp
> Subject: [R] "renaming" dataframe1 using "column" names from
> dataframe2?
> I have a dataframe named "temp", and another dataframe
> named "descriptions".
> I wish to "rename" temp, and to "call" it the names of
> a certain column in the dataframe "descriptions".
> Is there a good way to do this?
> A similar question:
> I am using a "for loop" to create several new
> dataframes.
> e.g.
> for(j in 1:9){…..
> I'd like each dataframe to be named d1, d2, d3, with
> the number being tied to the j (the iteration).
> Is this possible
> ______________________________________________
> 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