Commit dbb3a07d authored by Conor Anderson's avatar Conor Anderson

Add option for a multi-model mean value on anoms table.

parent caae4217
add_MMM <- function(datin) {
grouping <- c("Var", "Scenario", "Ensemble")
if (has_name(datin, "Month")) grouping <- c(grouping, "Month")
if (has_name(datin, "Season")) grouping <- c(grouping, "Season")
bind_rows(
datin,
dplyr::select(datin,-Model) %>%
group_by_at(grouping) %>%
summarize_all(mean) %>%
add_column(Model = "MMM", .before = which(names(datin) == "Model"))
)
}
...@@ -291,6 +291,9 @@ shinyServer(function(input, output, session) { ...@@ -291,6 +291,9 @@ shinyServer(function(input, output, session) {
if (is.element("Average Ensembles/Runs", input$add_proc)) { if (is.element("Average Ensembles/Runs", input$add_proc)) {
anom_data <- ensemble_means(anom_data) anom_data <- ensemble_means(anom_data)
} }
if (is.element("Add Multi-Model Mean", input$add_proc)) {
anom_data <- add_MMM(anom_data)
}
} }
anom_data anom_data
}) })
......
...@@ -108,7 +108,7 @@ dashboardPage( ...@@ -108,7 +108,7 @@ dashboardPage(
HTML("Use this tab to change the period of the analysis or to manipulate the final table.<br/><br/>"), HTML("Use this tab to change the period of the analysis or to manipulate the final table.<br/><br/>"),
selectInput("anom_period_in", "Change Period of Analysis", c("Annual", "Seasonal", "Monthly")), selectInput("anom_period_in", "Change Period of Analysis", c("Annual", "Seasonal", "Monthly")),
uiOutput("anom_selected_periods"), uiOutput("anom_selected_periods"),
checkboxGroupInput("add_proc", "Additional Processing", list("Baseline Averages", "Calculate Anomalies", "Average Ensembles/Runs"), inline = FALSE), checkboxGroupInput("add_proc", "Additional Processing", list("Baseline Averages", "Calculate Anomalies", "Average Ensembles/Runs", "Add Multi-Model Mean"), inline = FALSE),
HTML("<i>Note, some of the above options will only apply if you select multiple runs / scenarios from one model.</i> <br/><br/>") HTML("<i>Note, some of the above options will only apply if you select multiple runs / scenarios from one model.</i> <br/><br/>")
) )
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment