Commit b8c67ab6 authored by Conor Anderson's avatar Conor Anderson

Some minor tweaks.

parent 9c05d595
......@@ -2,7 +2,5 @@
.Rproj.user
local_settings.R
plumber_settings.R
shiny/packrat/lib*/
shiny/packrat/src/
shiny/shiny.Rproj
updateip.sh
......@@ -3,10 +3,12 @@ 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")
drop <- "Model"
if (has_name(datin, "Note")) drop <- c(drop, "Note")
bind_rows(
datin,
dplyr::select(datin,-Model) %>%
dplyr::select(datin, -drop) %>%
group_by_at(grouping) %>%
summarize_all(mean) %>%
add_column(Model = "MMM", .before = which(names(datin) == "Model"))
......
......@@ -259,7 +259,7 @@ shinyServer(function(input, output, session) {
## -- Get anom data and manipulate --- ##
generate_anom_data <- reactive({
time_series <- get_anom_ts()
if (isolate(isTRUE(input$convert_units))) time_series <- convert_units(time_series, input$var_filter)
if (isolate(isTRUE(input$convert_units))) time_series <- convert_units(time_series, isolate(input$var_filter))
process_raw_anom_ts(time_series, reac$anom_period_in,
baseline = isolate(input$baseline_in[1]:input$baseline_in[2]),
projection = isolate(input$projection_in[1]:input$projection_in[2]))
......@@ -308,7 +308,7 @@ shinyServer(function(input, output, session) {
# Ideally I could move this to a conditional panel.
output$precip_anom_note <- renderUI({
validate(need(input$anom_go, FALSE))
if (isolate(input$var_filter %in% c("pr", "prc")) &&
if (isolate(input$var_filter) %in% c("pr", "prc") &&
!is.null(input$add_proc) &&
is.element("Calculate Anomalies", input$add_proc)) {
out <- "<i>Precipitation anomalies are expresed as percentage change (%)</i><br><br>"
......@@ -348,7 +348,7 @@ shinyServer(function(input, output, session) {
output$download_anom_ts <- downloadHandler(
filename = "time_series.csv", content = function(file) {
time_series <- get_anom_ts()
if (isolate(isTRUE(input$convert_units))) time_series <- convert_units(time_series, input$var_filter)
if (isolate(isTRUE(input$convert_units))) time_series <- convert_units(time_series, isolate(input$var_filter))
time_series <- filter(time_series,
(grep("historical", Scenario) & Year %in% isolate(input$baseline_in[1]:input$baseline_in[2])) |
(!grep("historical", Scenario) & Year %in% isolate(input$projection_in[1]:input$projection_in[2])))
......
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