[R] Column name assignment problem

Steve Murray smurray444 at hotmail.com
Mon Mar 30 17:45:40 CEST 2009


Dear Peter, Jim and all,

Thanks for the information regarding how to structure 'assign' commands. I've had a go at doing this, based on your advice, and although I feel I'm a lot closer now, I can't quite get it to work:

rnames <- sprintf("%.2f", seq(from = -89.75, to = 89.75, length = 360))
columnnames <- sprintf("%.2f", seq(from = -179.75, to = 179.75, length = 720))

for (i in 1:120) {
        Fekete_table <- get(paste("Fekete_", index$year[i], index$month[i], sep=''))
        colnames(Fekete_table) <- columnnames
            rownames(Fekete_table) <- rnames
        assign(paste("Fekete_",index$year[i], index$month[i], sep=''),
        colnames(Fekete_table))
        }

This assigns the column headings to each table, so that each table doesn't contain data any longer, but simply the column values. I tried inserting assign(colnames(paste("Fekete_"...) but this resulted in the type of error that was mentioned in the previous message. I've run dry of ideas as to how I should restructure the commands, so would be grateful for any pointers.

Many thanks,

Steve


_________________________________________________________________
[[elided Hotmail spam]]




More information about the R-help mailing list