-1

I have an excel file which I am trying to read in R using read_excel function. The dates field in my data are pivoted up i.e. they are as columns. See screenshot below

enter image description here

The problem is when R reads the data file it converts the date fields columns to something like below.

enter image description here

Now, I have extracted the dates in a vector vDates and trying to convert them back to dates using below code , but it gives me error. enter image description here

Please let me know what is it that I am missing here!.

Appreciate the help.

Rohit Saluja
  • 1,517
  • 2
  • 17
  • 25
  • 2
    Please don't use images to share code and error messages. This makes it much harder for others to find questions via text search. – tarleb Aug 10 '18 at 19:42

1 Answers1

5

In your screen number 43102 is "2018-01-04", but real date for it is "2018-01-02".
I use this one:

as.Date(as.numeric(vdates), origin = "1899-12-30")
[1] "2018-01-01" "2018-02-01" "2018-03-01"
jyjek
  • 2,627
  • 11
  • 23