[R] Column name assignment problem

Steve Murray smurray444 at hotmail.com
Fri Mar 27 21:01:44 CET 2009


Dear all,

I've been trying to implement the advice given to me, but without much success so far. I thought I'd provide the code in full in the hope that it might make more sense. Just to reiterate, I'm attempting to change the header of the 4th column of every table to "COUNT".


year<- 1951:2000
filelist <- paste("C:\\Data\\arunoff_",year,".txt", sep="")
filelist


# Assign file names to individual objects

table_year=1951

for (i in filelist) {
          assign(paste("arunoff_",table_year,"_temp", sep=""),read.table(file=i, header=TRUE, sep=","))
          print(c("LOADED FILE: ","arunoff_",table_year,"_temp"), quote=FALSE)
          table_year = table_year+1
          }


# RE-FORMAT DATA

# Change names of particular column headings
          colnames(assign(paste("arunoff_",table_year, sep=""))[4],"COUNT")


Any help would be very much appreciated.

Thanks as ever,

Steve

_________________________________________________________________
[[elided Hotmail spam]]




More information about the R-help mailing list