[R] Loop

Florian Weiler fweiler08 at jhubc.it
Wed Feb 22 11:32:13 CET 2012


Dear all,

I have a (probably very basic) question. I am imputing data with the mice
package, using 10 chains. I can then write out the 10 final values of the
chains simply by

name1 <- complete(imp, 1)
                      :
                      :
name10 <- complete(imp,10)

Not a big deal, I just wanted to do that in a little loop as follows:

for (i in 1:10){
  set[i] <- complete(imp,i)}

Yet that doesn't work, I also tried other things like:
for (i in 1:10){
  set[[i]] <- complete(imp,i)}

Again, no success. It only saves a couple of lines of code, but there must
be an easy solution, right?
Thanks,
Florian

--
View this message in context: http://r.789695.n4.nabble.com/Loop-tp4409865p4409865.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list