[R] could not find function lapply<-

Luis Ridao Cruz Luisr at hav.fo
Tue Dec 8 12:38:06 CET 2009


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.




More information about the R-help mailing list