When I input dates on R using the code
day1<- as.Date("1999-03-12")
dates<-as.Date(day1+interval)
these codes output a list of dates, however when I use the code
cbind(x, dates)
The dates don't appear as dates, does anyone know how I can put this right so it they appear in the format of a date when transformed into a vector?
cbind()
creates a matrix
. Matrices in R are constrained to have the same class in all columns, so dates
is converted into whatever class (character, numeric) x
is.
Use data.frame(x=x,dates=dates)
instead.