[R] modifying colnames of tables in a loop

Benilton Carvalho bcarvalh at jhsph.edu
Thu Nov 16 15:38:18 CET 2006


how about:

for (x in l) colnames(get(x)) <- lower.case(colnames(get(x)))

b

On Nov 16, 2006, at 9:01 AM, Werner Wernersen wrote:

> Hi,
>
> I have a list with the names of tables, e.g.
> l <- c("t1","t2","t3")
> and I want to change the colnames of each of the
> tables in a for loop like this:
> for (x in l) {
>     colnames(eval(x)) <- lower.case(colnames(eval(x)))
> }
>
> This does not work but could someone give me some help
> to get on the right track?
>
> Thanks a million,
>   Werner
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list