[R] Converting a character string into a data frame name and performing assignments to that data frame
Dieter Menne
dieter.menne at menne-biomed.de
Sun Mar 21 10:23:46 CET 2010
Kavitha Venkatesan-2 wrote:
>
> variable.df is a character string that contains the name of the data
> frame that I want to do the following operations on:
>
> variable.df <- data.frame();
> # I can do the above command using
> assign( variable.df, data.frame() )
>
> How can I perform the assignment statements below ?
>
> colnames(variable.df) = colnames(some.other.df)
>
Try to avoid assign and eval when you are not fiRm; the first is rarely
used, and the second is a bit to powerful for safeR.
data(iris)
head(iris)
names(iris) = c("A","B","C","D","Spec")
head(iris)
Dieter
--
View this message in context: http://n4.nabble.com/Converting-a-character-string-into-a-data-frame-name-and-performing-assignments-to-that-data-frame-tp1676236p1676552.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list