In R, I have a vector of strings representing dates in two different formats:
- "month/day/year"
- "month day, year"
The first format has a two digit year so my vector looks something like this:
c("3/18/75", "March 10, 1994", "10/1/80", "June 15, 1979",...)
I want to put the dates in the vector in a standard format. This should be easy with the mdy
function from the lubridate
package, except when I pass it the first format, it returns an unwanted century.
mdy("3/18/75")
returns "2075-03-18 UTC"
Does anyone know how it can return the date in the 20th century? That is "1975-03-18 UTC". Any other solution of how to standardize the dates will be greatly appreciated as well.
I am running version lubridate_1.3.3 if that matters.
as.Date("3/18/75", "%m/%d/%y")
returns the correct century. The lubridateorigin
is the standard 1970 origin as well. Weird. – Rich Scriven