Skip to content

Commit

Permalink
Update mod_figures.R
Browse files Browse the repository at this point in the history
found another bug in the two-characteristic scatterplot! fixed.
  • Loading branch information
elisehinman committed Sep 9, 2023
1 parent 3ee1e0d commit d215e26
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/mod_figures.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mod_figures_server <- function(id, tadat){
shiny::observeEvent(input$mapplotgroupgo,{
react$groups = input$mapplotgroup
groupdata = subset(react$dat, react$dat$groupname%in%c(react$groups))
react$plotdata = groupdata
react$plotdataset = groupdata
react$mapdata = groupdata %>%
dplyr::group_by(OrganizationFormalName, MonitoringLocationIdentifier, MonitoringLocationName, MonitoringLocationTypeName, TADA.LatitudeMeasure, TADA.LongitudeMeasure) %>%
dplyr::summarise(Ncount = length(ResultIdentifier), MeanV = mean(TADA.ResultMeasureValue), GroupID = paste0(unique(sort(groupname)), collapse = ";"), DateRange = paste0(min(lubridate::year(as.Date(ActivityStartDate, "%Y-%m-%d")))," - ", max(lubridate::year(as.Date(ActivityStartDate, "%Y-%m-%d")))))
Expand Down Expand Up @@ -215,9 +215,9 @@ mod_figures_server <- function(id, tadat){
# when the Go button is pushed to generate plots, this ensure the plot data is filtered to the selected sites (or all sites)
shiny::observeEvent(input$selsitesgo,{
if(all(input$selsites1=="All sites")){
react$plotdata = subset(react$dat, react$dat$groupname%in%c(react$groups))
react$plotdata = react$plotdataset
}else{
plotdata = react$dat %>% dplyr::filter(MonitoringLocationIdentifier%in%input$selsites1)
plotdata = react$plotdataset %>% dplyr::filter(MonitoringLocationIdentifier%in%input$selsites1)
if(!react$groups[1]%in%plotdata$groupname){
shiny::showModal(shiny::modalDialog(
title = "Whoops!",
Expand Down Expand Up @@ -294,7 +294,7 @@ mod_figures_server <- function(id, tadat){
output$scatter2 <- plotly::renderPlotly({
shiny::req(react$plotdata)
if(length(unique(react$plotdata$groupname))>1){
suppressWarnings(TADA::TADA_TwoCharacteristicScatterplot(react$plotdata, id_col = "group", groups = unique(react$plotdata$group)))
suppressWarnings(TADA::TADA_TwoCharacteristicScatterplot(react$plotdata, id_col = "groupname", groups = unique(react$plotdata$groupname)))
}
})

Expand Down

0 comments on commit d215e26

Please sign in to comment.