R-help, I have a list whose elements are data frames. I want to change the colnames attribute in each element of this list but an error message comes up:
> lapply(LD_strataNew,function(x) dimnames(x)[[2]][-1]) <- as.roman(1:9)[-6] Error in lapply(LD_strataNew, function(x) dimnames(x)[[2]][-1]) <- as.roman(1:9)[-6] : could not find function "lapply<-" > lapply(LD_strataNew,function(x) dimnames(x)[[2]]) $`1996` [1] "lgdcm" "X1" "X2" "X3" "X4" "X5" "X7" "X8" "X9" $`1997` [1] "lgdcm" "X1" "X2" "X3" "X4" "X5" "X7" "X8" "X9" $`1998` [1] "lgdcm" "X1" "X2" "X3" "X4" "X5" "X7" "X8" "X9" ....... ....... ....... Why does it not work? Thanks in advance. ______________________________________________ R-help@r-project.org 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.