# 06 Ship To Shiny.r


## re compose ALL.DTs
useDate <- TRUE
nms.ALL.DTs.using <- paste0("ALL.DTs.", c("yes", "no"), ".totals.", ifelse(useDate, "yes", "no"), ".dates" )
ALL.DTs <- do.call(c, lapply(nms.ALL.DTs.using, get) )



shinyFolder <- as.path(srcDir, "FBShiny_app", expand=FALSE)
G.out <- "GPlots"
D.out <- "DTs"
ext   <- ".RDS"

f.outs <- c()
f.outs[c("G", "D")] <- as.path(shinyFolder, c(G.out, D.out), ext=ext, expand=FALSE)


using <- c( "fb_agg_date"
          , "fb_agg_date_label"
          , "fb_agg_date_campaign"
          , "fb_agg_date_age"
          , "fb_agg_date_gender"
          )

# this is what is going to shiny
GPlots <- GVisPlots[using]
DTs    <- ALL.DTs[using]

# Temporary, til I establish a better system
# names(GPlots) <- c("Overview", "Label", "Campaign", "Age", "Gender")

saveRDS(GPlots, file=f.outs[["G"]] )
saveRDS(DTs,    file=f.outs[["D"]] )
cat("\nFILES LOCATED IN: \n\t", c(shinyFolder, f.outs), "\n", sep="\n\t")
