I have a data frame (df) like the following:
Date Arrivals 2014-07 100 2014-08 150 2014-09 200
I know that I can con
Here is a way to do it using the zoo package.
R code:
library(zoo) df # Date Arrivals # 1 2014-07 100 # 2 2014-08 150 # 3 2014-09 200 df$Date <- as.Date(as.yearmon(df$Date), frac = 1) # output # Date Arrivals # 1 2014-07-31 100 # 2 2014-08-31 150 # 3 2014-09-30 200