I´m trying to append the result of a for loop which produces a vector with different length, after each iteration. I need to have the result of each loop side by side in each column. This is the error I get:
Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 0, 3650
I have tested this with vectors with the same size but I get the same error. I have tried some of the solutions that I found here: Append data frames together in a for loop but whithout success, some of them work but results appear in a single column . How can I fix this?
d = NULL
for (i in 1:10) {
# vector output
model <- # vector with different length for each iteration
# add vector to a dataframe
df <- data.frame(model)
}
df_total <- cbind(d,df)