# initialise list
path <- system.file("testdata", "three5/scenario_0", package = "mm.reoptimise")
scenario <- create_scenario(path)
scenario_list <- list(scenario)
# Test if no scenarios are ran yet
# make a new scenario
myscenario_profit <- set_scenario(scenario_list[[1]],
period = "month",
budget = 3.8e7,
kpi1 = "Profit",
kpi2 = NA,
kpi3 = NA)
myscenario_profit <- run_optimization(
scenario = myscenario_profit)
# add new scenario to the list
myname <- "38m profit"
scenario_list <- add_scenario(scenario_list, myscenario_profit, myname)
summarise_scenarios(scenario_list) %>% dplyr::pull(name)
all_scenarios_table <- create_all_scenarios_table(scenario_list)
df <- chart_overview_summary(all_scenarios_table,
selected_scenarios = "38m profit")
# test function
test_that("output is correct", {
expect_true(is.data.frame(df))
expect_true(nrow(df)>0)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.