R converting a character to a date -
this question has answer here:
i have character string of type dec 2016 , want convert date.
i tried:
dates1 <- c("dec 2016", "feb 2017", "nov 2018") dates2 <- as.date(dates1,format="%b %y")
but did not work.
thank help.
dates1 <- c("dec 2016", "feb 2017", "nov 2018") library(zoo) dates2 <- as.date(as.yearmon(dates1)) dates2 [1] "2016-12-01" "2017-02-01" "2018-11-01" class(dates2) [1] "date"
you should googling.
Comments
Post a Comment