[R] could not find function lapply<-
Gray Calhoun
gray.calhoun at gmail.com
Tue Dec 8 15:44:21 CET 2009
Hi Luis,
You can't assign to lapply.
--Gray
On Tue, Dec 8, 2009 at 5: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.
>
--
Gray Calhoun
Assistant Professor of Economics
Iowa State University
More information about the R-help
mailing list