[R] errors when trying to rename data frame columns

bogdan romocea br44114 at yahoo.com
Sun Dec 12 22:29:13 CET 2004

Dear R users,

I need to rename the columns of a series of data frames. The names of
the data frames and those of the columns need to be pulled from some
vectors. I tried a couple of things but only got errors. What am I

#---create data frame
dframes <- c("a","b","c")

#---rename the columns
cols <- c("one","two")

> names(get(dframes[2])) <- cols
Error: couldn't find function "get<-"
> assign(dframes[2],data.frame(cols[1]=11:20,cols[2]=21:30))
Error: syntax error
> labels(get(dframes[2]))[[2]] <- cols
Error: couldn't find function "labels<-"

I'm using R 2.0.0 on Windows XP.

Thank you,

More information about the R-help mailing list