I have list of length 18 , when I tried to merge these list for creating data frame it changes format for date to numeric.
I have used below syntax
forecast_data = do.call(rbind, datalist)
there are 3 dates column all changed to numeric when I execute above code.
Is there a way I can keep type of date column as date only while merging list. Please advice.
Please refer to below sample list and result which I want to achieve from set of list
datalist = list()
l <- data.frame(ID=c(1), Date=as.Date("2017-07-02"), Prediction=c(66))
l <- as.list(l)
datalist[[1]] <- (l)
l <- data.frame(ID=c(1), Date=as.Date("2017-07-09"), Prediction=c(70))
l <- as.list(l)
datalist[[2]] <- (l)
l <- data.frame(ID=c(1), Date=as.Date("2017-07-16"), Prediction=c(77))
l <- as.list(l)
datalist[[3]] <- (l)
result <- data.frame(ID=c(1,1,1), Date=c("2017-07-02","2017-07-09","2017-07-16"), Prediction=c(66,70,77))