empdataCA4 <- lapply(split(empdataCA3, empdataCA3$reg), function(x) {
x.Date <- (c(CurrentYear, CurrentYear + 1, CurrentYear + 2, CurrentYear + 3, CurrentYear +4 ,CurrentYear +5))
val <- as.ts(na.approx(zoo(x = c(x$Pct[1],NA,NA,NA,NA,x$Pct[2]), x.Date)))
val2 <-predict(td(val~1, to='quarterly', method='denton-cholette', conversion = "last"))
# change the options for interpolation as needed
data.frame(yearQtr= as.yearqtr(time(val2)), test=val2)})
df.dplyr <- as.data.frame(bind_rows(empdataCA4, .id = "groups"))
df.dplyr0 <- as.data.frame(stringr::str_split_fixed(df.dplyr$groups, "_", n=2))
colnames(df.dplyr0) <- c("Bracket", "Region")
df.dplyr01 <- cbind(df.dplyr0,df.dplyr) %>% select(-groups)
df.dplyr01$yearQtr2 <- as.yearqtr(df.dplyr01$yearQtr)