[R] could not find function lapply<-

Henrique Dallazuanna wwwhsd at gmail.com
Tue Dec 8 12:44:24 CET 2009


You can try this instead:

lapply(LD_strataNew, 'colnames<-', as.character(as.roman(1:9)[-6]))

On Tue, Dec 8, 2009 at 9:38 AM, Luis Ridao Cruz <Luisr at hav.fo> wrote:
> 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 at 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O




More information about the R-help mailing list