I have three data frames - Winter, Spring, and Summer for years from 2014-2018. Winter months are January, February, November, December. Spring Months from March-June. Summer months from July - October. I have daily data for all the months for all seasons but have the Date column in 'Month_Year' character string. My question is how do I convert 'Month_Year' character string to a full date format '%Y-%m-%d'?
I am able to convert 'Month_Year' to yearmon using the as.yearmon function and then later convert it to a date using as.Date function. But it returns the first day of the month for every day of the month.
Following is the miminum reproducible example:
df1 <- data.frame(rep("July_2014",31))
names(df1) <- 'date'
df1$fulldate <- as.yearmon(df1$date, "%b_%Y")
df1$fulldate_Date <- as.Date(as.yearmon(df1$fulldate, "%m-%Y"))
Similarly, I will have three different data frames for three different seasons for years 2014-2018. Finally, I will need to merge all three data frames and create a single continuous time series from 2014-01-01 to 2018-10-31
rbind
your three date columns from your three data frames, and then rununique
to remove duplicates? – Mako212