0

I loaded data from a csv that contains dates in the format 25-DEC-2018. I loaded this csv as a data.frame using read.csv, which converted the dates to Factors. I want to convert them back to dates using the function as.Date. I am using the command:

test1 <- as.Date(dateframe,format="%d-%b-%y")

However, the resulting value for test1 is 2020-12-25, which is 2 years greater than the date.frame value of 25-DEC-2018. Any ideas what could be causing this? Or is there an easier way to load the date data as a Date instead of a Factor?

LocoGris
  • 4,432
  • 3
  • 15
  • 30
John
  • 43
  • 3

1 Answers1

0

Try

test1 <- as.Date(as.character(dateframe),format="%d-%b-%Y")