0

I'm loading an Excel file which has a column where dates are stored as integers (43000 for example is 2017-09-22). I tried applying the answer to this question this way:

df = df %>%
  mutate(date = as.Date(date, origin = "1899-12-30"))

But I'm having the following error:

Error in mutate_impl(.data, dots) : Evaluation error: character string is not in a
standard unambiguous format. Calls: (...)

I searched for this problem and all results are about incorrectly specifying a string input to as.Date but in this situation the input is an integer.

gsmafra
  • 2,294
  • 17
  • 25

1 Answers1

3

Just found the problem: the dates were somehow loaded as string instead of integers. This solved my problem:

df = df %>%
  mutate(date = as.Date(as.numeric(date), origin = "1899-12-30"))
gsmafra
  • 2,294
  • 17
  • 25