Skip to content

Commit

Permalink
Update data input selection in regional composition plot
Browse files Browse the repository at this point in the history
  • Loading branch information
langbart committed Oct 18, 2023
1 parent 6906753 commit 8937af2
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions R/mod_region_composition.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
mod_region_composition_ui <- function(id, heading = NULL, apex_height = "20rem", ...) {
ns <- NS(id)

# if (is.null(years)) {
years <- seq(as.numeric(format(Sys.Date(), "%Y")), "2018")
# }
years <- list("Year" = seq(as.numeric(format(Sys.Date(), "%Y")), "2018"))

s <- selectInput(ns("y"),
label = "",
choices = years,
choices = c("All data", years),
selectize = FALSE,
width = "auto"
)
Expand Down Expand Up @@ -60,11 +58,18 @@ mod_region_composition_server <- function(id,
ns <- session$ns

plot_data <- reactive({

if (input$y == "All data") {
year_selected <- c(2018:data.table::year(Sys.Date()))
} else {
year_selected <- input$y
}

region_composition <-
peskas.timor.portal::municipal_taxa %>%
dplyr::select(region, date_bin_start, catch, grouped_taxa) %>%
dplyr::mutate(year = data.table::year(date_bin_start)) %>%
dplyr::filter(year %in% input$y) %>%
dplyr::filter(year %in% year_selected) %>%
dplyr::group_by(region, grouped_taxa) %>%
dplyr::summarise(catch = sum(catch)) %>%
dplyr::mutate(
Expand Down
Binary file modified data/aggregated.rda
Binary file not shown.
Binary file modified data/data_last_updated.rda
Binary file not shown.
Binary file modified data/indicators_grid.rda
Binary file not shown.
Binary file modified data/label_groups_list.rda
Binary file not shown.
Binary file modified data/municipal_aggregated.rda
Binary file not shown.
Binary file modified data/municipal_taxa.rda
Binary file not shown.
Binary file modified data/nutrients_aggregated.rda
Binary file not shown.
Binary file modified data/pars.rda
Binary file not shown.
Binary file modified data/summary_data.rda
Binary file not shown.
Binary file modified data/taxa_aggregated.rda
Binary file not shown.
Binary file modified data/taxa_names.rda
Binary file not shown.

0 comments on commit 8937af2

Please sign in to comment.