0

I am having some problems with changing dates from Excel (characters in R) into date in R.

Knowing that I am using : as.Date(Data$Datum, "d%/m%/y%") But it returns NA NA NA..

And the date starts in Excel on : 1-1-2019 , but in R it shows : "43466"

I have tried also lubridate : dmy(Data$Datum) , but it also returns all the values as NA.

Could you please help me with this situation!

Thanks in advance!

A.A
  • 15
  • 3
  • Sounds like you're getting the underlying Excel representation of a date. See https://stackoverflow.com/q/43230470/4550695 for potential solutions. – Mikko Marttila Aug 09 '22 at 10:32

1 Answers1

0

Fix this part and everything will be ok,

date <- as.Date(Data$Datum, "%m-%d-%Y")

Place the % sign in front and use Y not y because it is 2019 and not 19.

Finally, separate mdY with "-"