Skip to content
Prev 369867 / 398503 Next

How to Transform a Factor Variable into a Date

A couple thoughts:

1. converting factors into dates often requires that they be converted to
character first.

2. you don't really have dates; you have just months and years

3. therefore perhaps the as.yearmon() function in the zoo package could help

library(zoo)
my.factor <- factor("Feb 2017")
as.yearmon(my.factor)  ## gets around the factor-vs-character issue
On Mon, Jun 19, 2017 at 3:07 PM, Paul Bernal <paulbernal07 at gmail.com> wrote: