I have some data in year-month form that I want to format for graphing in ggplot
.
date <- c("2016-03", "2016-04", "2016-05", "2016-06", "2016-07", "2016-08",
"2016-09", "2016-10", "2016-11", "2016-12")
I was using parsedate::parse_date
, but since updating R it no longer functioning.
I have looked at
as.yearmon
works fine but it doesn't format to POSIXct which I need for ggplot
. Other formatting such as as.POSIXct
and strptime
are giving NAs or errors.
Note: I don't mind if the first of the month gets added to the "year-mo" format.