0

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?

Maciej
  • 3,255
  • 1
  • 28
  • 43
Kate
  • 127
  • 1
  • 4

1 Answers1

0

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.

Stephan Kolassa
  • 7,953
  • 2
  • 28
  • 48