2
The result of the loop for each iteration is a vector. I intend to send this vector to a data.frame and then export it to Excel.
I basically use the cbind function to send each of my 10 model results to a data.frame. This small example works but only if the 10 outputs of the model have the same number of rows (this is because the cbind function only works if the columns of the data.frames have the same number of rows). The vectors I get have a different size. How can I get around this question?
d <- lapply(1:10, function(i) {model <- code
data.frame(model)})
df_total <- do.call(cbind, d)
you probably need to work with a list, or create values
NA
on your vector so that all vectors are the same size so you can make a cbind(). For an exact/better answer, please ask a reproducible question– Guilherme Parreira