Probably trivial but tricky for me to get it right.
Given the start and end date in A, as well as duration in months between the date range:
A=
structure(list(start..yyyy.mm. = c(197901L, 197901L, 197901L,
197901L, 197901L), X.yyyy.mm. = c(197901L, 197904L, 197908L,
197902L, 197902L), duration = c(1L, 4L, 8L, 2L, 2L), area..km.2. = structure(c(1L,
2L, 4L, 3L, 5L), .Label = c("46952.85", "c(125267.7, 72379.43, 72468.91, 13200.26)",
"c(19814.74, 39570.96)", "c(26513.05, 26513.05, 26513.05, 26513.05, 26513.05, 19898.57, 26513.05, 26513.05)",
"c(52291.77, 52291.77)"), class = "factor")), .Names = c("start..yyyy.mm.",
"X.yyyy.mm.", "duration", "area..km.2."), class = "data.frame", row.names = c(NA,
-5L))
I would like to produce something similar to the plot shown below (ignore the histogram). Each duration is colored differently. In A, the first area value corresponds to the first month in date range etc..
The dates in A are not continuous as you can see. Therefore, the intention is to create a continuous date axis such as ts <- seq(as.Date("1910-01-01"), as.Date("2015-12-31"), by="month")and shade areas with respect to start and enddates for a given duration.
Date ranges where no values where recorded should have NA.
How can I implement this is R using any package?
First idea in that came to mind was to create a continuous date as:
library(dplyr)
data_with_missing_times <- full_join(ts,A)
then do the plotting? a similar question is here but here I intend to shade date ranges. My data goes from 1910 - 2015 with missing date ranges at some intervals.
Thank you.


