You need to change the data structure to one that can actually hold different data types (i.e. a data frame) and then rbind
them together:
for (i in 1:n) {
#Some operations
mylist[[i]] <- data.frame(sample(dates,1),as.numeric(sample(x,1)))
}
z <- do.call(rbind,mylist)
The problem in your code was that the cbind
operation coerced the list
to a matrix
(which is the default behavior of rbind
/cbind
) which can only hold one data type.