running randomForest loop and variable importance in R
<p>I would like to run 100 times <code>randomForest</code> regression in R, get variable importance for each running and write the result of variable importance as csv file(including 100 results for variable importance). This is my code and its error:</p>

<pre><code>result&lt;-data.frame(IncMSE="%IncMSE", IncNodePurity="IncNodePurity")
for (i in 1:3){
imp[i]&lt;- importance(randomForest(train[,1:11], train[,12], data = train,importance = TRUE, ntree =5000, proximity = TRUE, mtry=3))
results&lt;-cbind(result,imp[i])  
}
write.csv(results,"D:/vari.csv")

Warning messages:
In imp[i] &lt;- importance(randomForest(train[, 1:11], train[, 12],  :
number of items to replace is not a multiple of replacement length
</code></pre>

<p>How to fix it? Many thanks.</p>