How can I change month/day/year character object format into date in Corpus metadata?

57 views Asked by At

I am trying to change the metadata in a Corpus but I have the day column displayed as 7/25/2014 and I want to make sure the console is understanding it as a date

2

There are 2 answers

0
MelaniaCB On BEST ANSWER

This is it:

> library(lubridate)
> data$File.Date <- mdy(data$File.Date)
> class(data$File.Date)
[1] "Date"
0
Chelmy88 On

Without extra package, you can use:

data$File.Date <- as.Date(strptime(data$File.Date, "%m/%d/%Y"))