Skip to content
Snippets Groups Projects
server.R 36.2 KiB
Newer Older
                 lci = get_metrics(N = out$run$N)$scenario$impact[time_horzion, "lci",-1],
                 uci = get_metrics(N = out$run$N)$scenario$impact[time_horzion, "uci",-1])
      }

    } else {
      # When run is NULL

      if(!is.null(out$msg)){

        # Print the error msg, if there is one
        if(out$msg == "error_not_ready"){
          paste0("Erreur: Vous n'avez pas lancer l'analyse 'valeurs experts'")
        }else{
          paste0("Some other error occurred")
        }

      }else{
        # When no error msg : nothing happens
      } # if "msg"
    } # if "run
Marie-Bocage's avatar
Marie-Bocage committed

  # Display title
  output$title_impact_result <- renderText({
    if(input$run > 0){
      "Rsultat : Impact estim au bout de 30 ans"
    }
  })

  # Display result (text for non cumulated impacts)
  output$impact_text <- renderText({
    }else{
      if(!param$cumulated_impacts){
        print_out()
      } else{
        NULL
      }
Marie-Bocage's avatar
Marie-Bocage committed

  # Display result (table for cumulated impacts)
  output$impact_table <- renderTable({
    if(input$run == 0){
      NULL
    }else{
      if(param$cumulated_impacts){
        print_out()
      } else{
        NULL
      }
    }
  }, rownames = TRUE)

  ##-------------------------------------------
  ## Plot Impacts
  ##-------------------------------------------
  ## Function to plot the impact
  plot_out_impact <- function(){
thierrychambert's avatar
thierrychambert committed
    if(is.null(out$run)) {} else {
      plot_impact(N = out$run$N, onset_year = param$onset_year, percent = TRUE,
                  xlab = "\nAnne", ylab = "Impact relatif (%)\n")
      }
  output$title_impact_plot <- renderText({
    if(input$run > 0){
      "Rsultat : Impact relatif au cours du temps"
    }
  })

  output$impact_plot <- renderPlot({
    plot_out_impact()
  })

  ##-------------------------------------------
  ## Plot Demographic Trajectories
  ##-------------------------------------------
  # Function to plot trajectories
  plot_out_traj <- function(){
    if(is.null(out$run)) {} else {plot_traj(N = out$run$N, xlab = "year", ylab = "pop size")}
  }

  output$title_traj_plot <- renderText({
    if(input$run > 0){
      "Graphique : Trajectoire dmographique"
    }
  })

  output$traj_plot <- renderPlot({
thierrychambert's avatar
thierrychambert committed
  ###################################################################################
thierrychambert's avatar
thierrychambert committed