I\'m new on R language and I still have a lot to learn. I\'ve a list W of J elements and I would like to rename its elements W[[i]] with Wi>
W
W[[i]]
Wi>
Alternatively you can use sprintf():
sprintf()
w<-list(a="give",b="me an",c="example") names(w)<-sprintf("W%i",1:length(w))
As you can see, you do not need a loop for this.
It should do the work. In this example, the names are W1,W2 and W3
print(w) $W1 [1] "give" $W2 [1] "me an" $W3 [1] "example"