Data example.
date1 = seq(as.Date("2019/01/01"), by = "month", length.out = 29)
date2= seq(as.Date("2019/05/01"), by = "month", length.out = 29)
subproducts1=rep("1",29)
subproducts2=rep("2",29)
b1 <- c(rnorm(29,5))
b2 <- c(rnorm(29,5))
dfone <- data.frame("date"= c(date1,date2),
"subproduct"=
c(subproducts1,subproducts2),
"actuals"= c(b1,b2))
Run Code Online (Sandbox Code Playgroud)
Max Date for Subproduct 1 is May 2021 and max date for Subproduct 2 is Sept 2021.
Question: Is there a way to: