Converting yearmon column to last date of the month in R
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 convert the yearmon dates to the first date of each month as follows: df$Date <- as.POSIXct(paste0(as.character(df[,1]),"-01"), format = "%Y-%m-%d") However, given that my data is not available until the end of the month I want to index it to the end rather than the beginning, and I cannot figure it out. Any help appreciated. If the Date variable is an actual yearmon class vector, from the zoo package, the as.Date.yearmon method can do what you want via its argument frac . Using