Possible Duplicate:
How to name variables on the fly in R?
I have 10 objects of type list named: list1
, list2
, ..., list10
. And I wanted to use the output from my function FUN
to replace the first index of these list variables through a for
loop like this:
for (i in 1:10){
eval(parse(test=(paste("list",i,sep=""))))[[1]] <- FUN()
}
but this does not work. I also used lapply
in this way and again it is wrong:
lapply(eval(parse(text=(paste("list",i,sep=""))))[[1]], FUN)
Any opinion would be appreciated.