#function to generate cmd, given a named list of flags
gencmd <- function(script_args) {
cmdstring <- "Rscript generate_idd_plots.R "
for(flag in names(script_args)) {
cmdstring <- paste0(cmdstring, flag, " \"", script_args[[flag]], "\" ")
}
return(cmdstring)
}
#manually construct list of flags
script_args <- list("-r"= "2020-07-22",
"-g"= "us",
"-s"= "<Put Caption Here>",
"-e"= "../data/us_data_territories.csv",
"-m"= "../data/q_summ_country.csv",
"--modelend" = "2020-09-04",
"--convertIDD" = TRUE)
#generate the cmd
mycmd <- gencmd(script_args)
#use the shell cmd to execute the cmd
shell(mycmd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.