I have a vector of numeric excel dates i.e.
date <- c(42963,42994,42903,42933,42964)
The output am I expecting when using
Type excel_numeric_to_date
to look at the function's code and you'll see it's a wrapper for the line of code used by the other answers to this question: as.Date(date_num, origin = "1899-12-30")
.
So that's not the issue.
The underlying matter here is confusion about date formatting. You say you expect your first number 42963
to become "Aug 2016"
, and your last number 42964
to become "Aug 2017"
. The latter is just one more than the former, which shows up in the conversion - they should be a day apart, not a year apart as you are expecting:
> excel_numeric_to_date(c(42963, 42964))
[1] "2017-08-16" "2017-08-17" # as expected, they are one day apart
Perhaps the day and year fields are switched upstream in your data at the point where these get mapped to integer dates, and it was hard to tell here because of the values chosen.