I've found the solution to my problem (see below), although it looks
somewhat ugly: 

sim <- c('simMeans','simVars','simWeights')
indexTable <- table(modelIndex)
for (i in sim) {
    assign(tmp <- paste(i,'By',sep=''),split(get(i), modelIndex))
    lapply(seq(along=indexTable), function(j)
           
eval(parse(text=paste('dim(',tmp,'[[',j,']])','<<-','c(indexTable[',j,'],K)'))))
}

> Date: Fri, 17 Oct 2003 11:50:29 -0500 (CDT)
> From: Giovanni Petris <[EMAIL PROTECTED]>
> Sender: [EMAIL PROTECTED]
> Precedence: list
> 
> 
> I am creating lists of vectors withing a loop. I also would like to
> change the dim attribute to the vectors in order to make them
> matrices. 
> 
> I have tried the following, but it doesn't work...
> 
> > sim <- c('simMeans','simVars','simWeights')
> > indexTable <- table(modelIndex)
> > for (i in sim) {
> +     assign(tmp <- paste(i,'By',sep=''),split(get(i), modelIndex))
> +     lapply(seq(along=indexTable),function(j) attr(get(tmp)[[j]],'dim') <<- 
> c(indexTable[j],K))
> + }
> Error in FUN(X[[1]], ...) : couldn't find function "get<-"
> In addition: Warning message: 
> argument lengths differ in: split(x, f) 
> 
> Any suggestions will be appreciated. 
> Thanks
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 
>

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to