Newer
Older
library(shiny)
library(shinyjs)
library(shinyMatrix)
library(tidyverse)
library(eolpop)
species_data <- read.csv("./inst/ShinyApp/species_list.csv", sep = ",")
species_list <- unique(as.character(species_data$NomEspece))
data_sf <- read.csv("./inst/ShinyApp/survivals_fecundities_species.csv", sep = ",")#, encoding = "UTF-8")
# Fixed parameters (for now)
nsim = 10
coeff_var_environ = 0.10
time_horzion = 30
#####################
### Pre-fill data ###
#####################
eli_fatalities <- c(1.0, 2, 5, 8, 0.80,
0.2, 0, 3, 6, 0.90,
0.2, 2, 4, 10, 0.90,
0.1, 1, 3, 7, 0.70)
eli_pop_size <- c(1.0, 150, 200, 250, 0.80,
0.5, 120, 180, 240, 0.90,
0.8, 170, 250, 310, 0.90,
0.3, 180, 200, 230, 0.70)
eli_carrying_cap <- c(1.0, 500, 700, 1000, 0.80,
0.5, 1000, 1500, 2000, 0.90,
0.8, 800, 1200, 1600, 0.90,
0.3, 100, 1200, 1500, 0.70)
eli_pop_growth <- c(1 , 0.95, 0.98, 1.00, 0.95,
0.2, 0.97, 1.00, 1.01, 0.90,
0.5, 0.92, 0.96, 0.99, 0.90,
0.3, 0.90, 0.95, 0.98, 0.70)
## Other pre-fill data
# fatalities for several wind farms (cumulated impacts)
init_cumul <- c(10, 5, 8,
0.05, 0.05, 0.05,
2010, 2015, 2018)
#rMAX_species <- rMAX_spp(surv = tail(init_survivals,1), afr = min(which(init_fecundities != 0)))
##--------------------------------------------
## User Interface --
##--------------------------------------------
titlePanel("eolpop : Impact demographique des oliennes"),
# Creation of the first page (select species, analysis type choice)
selectInput(inputId = "species_choice", selected = 1,
h4(strong("Slectionner un type d'analyse")),
choices = c("Impacts non cumuls" = "scenario", "Impacts cumuls" = "cumulated"))
##--------------------------------------------
## General information --
##--------------------------------------------
column(width = 4,
div( textOutput(outputId = "species_name") ,
style="color:black; font-size:18px; font-weight: bold", align = "left"),
)
),
textOutput(outputId = "fatalities_mean_info"),
textOutput(outputId = "fatalities_se_info"),
h3("Taille de la population"),
h3("Capacit de charge"),
h3("Tendance de la population"),
textOutput(outputId = "pop_growth_mean_info"),
textOutput(outputId = "pop_growth_se_info")),
h3("Paramtres dmographiques"),
) # # End wellPanel
), # End fluidRow
# Paramter Inputs (fatalities, pop size, carrying capacity, pop trend and vital rates).
h2("Modifier les paramtres"),
br(" "),
##--------------------------------------------
## 1. Fatalities --
##--------------------------------------------
tags$style(HTML('#button_fatalities{background-color:#C2C8D3}')),
label = tags$span("Mortalits annuelles", style = "font-weight: bold; font-size: 18px;")
),
label = h4("Modlisation"),
choices = c("Taux de mortalits (h) constant" = "h",
"Nombre de mortalits (M) constant" = "M")),
label = h4("Type de saisie"),
label = "Moyenne des mortalits annuelles",
label = "Erreur-type des mortalits annuelles",
min = 0, max = Inf, step = 0.1),
# Matrix for expert elicitation
value = matrix(data = eli_fatalities, nrow = 4, ncol = 5,
class = "numeric",
rows = list(names = TRUE),
cols = list(names = TRUE)),
actionButton(inputId = "fatalities_run_expert", label = "Utiliser valeurs experts"),
label = "Nombre de parcs oliens",
dimnames = list(c(paste0("Parc n", c(1:3))),
"Anne de mise en service du parc"))),
class = "numeric",
rows = list(names = TRUE),
cols = list(names = TRUE)),
##--------------------------------------------
## 2. Population Size --
##--------------------------------------------
tags$style(HTML('#button_pop_size{background-color:#C2C8D3}')),
label = tags$span("Taille de la population", style = "font-weight: bold; font-size: 18px;")
),
choices = c("Nombre de couple" = "Npair", "Effectif total" = "Ntotal")),
radioButtons(inputId = "pop_size_input_type",
label = h4("Type de saisie"),
choices = c("Valeurs", "Elicitation d'expert")),
numericInput(inputId = "pop_size_mean",
label = "Moyenne de la taille de la population",
value = 200,
label = "Erreur-type de la taille de la population",
value = matrix(data = eli_pop_size, nrow = 4, ncol = 5,
class = "numeric",
rows = list(names = TRUE),
cols = list(names = TRUE)),
actionButton(inputId = "pop_size_run_expert", label = "Utiliser valeurs experts"),
##--------------------------------------------
## 3. Carrying capacity --
##--------------------------------------------
tags$style(HTML('#button_carrying_cap{background-color:#C2C8D3}')),
label = tags$span("Capacit de charge", style = "font-weight: bold; font-size: 18px;")
),
label = h4("Type de saisie"),
value = matrix(data = eli_carrying_cap, nrow = 4, ncol = 5,
class = "numeric",
rows = list(names = TRUE),
cols = list(names = TRUE)),
actionButton(inputId = "carrying_cap_run_expert", label = "Utiliser valeurs experts"),
##--------------------------------------------
## 4. Population Trend --
##--------------------------------------------
tags$style(HTML('#button_pop_trend{background-color:#C2C8D3}')),
label = tags$span("Tendance de la population", style = "font-weight: bold; font-size: 18px;")
),
label = h4("Type de saisie"),
choices = c("Taux de croissance", "Elicitation d'expert", "Tendance locale ou rgionale")),
numericInput(inputId = "pop_growth_mean",
label = "Moyenne de la croissance de la population",
value = 1,
label = "Erreur-type de la croissance de la population",
value = matrix(data = eli_pop_growth, nrow = 4, ncol = 5,
class = "numeric",
rows = list(names = TRUE),
cols = list(names = TRUE)),
actionButton(inputId = "pop_growth_run_expert", label = "Utiliser valeurs experts"),
choices = c("Croissance", "Stable", "Dclin")),
radioButtons(inputId = "pop_trend_strength",
label = NULL,
choices = c("Faible", "Moyen", "Fort")),
# tags$style("#pop_trend_strength {position:fixed; top: 600px; right: 100px;}"),
##--------------------------------------------
## 5. Vital rates --
##--------------------------------------------
tags$style(HTML('#button_vital_rates{background-color:#C2C8D3}')),
label = tags$span("Paramtres dmographiques", style = "font-weight: bold; font-size: 18px;")
),
dimnames = list(c("Juv 1", "Juv 2", "Adulte"), c("Survie", "Fcondit"))),
class = "numeric",
rows = list(names = TRUE),
cols = list(names = TRUE))
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mainPanel(
tabsetPanel(
tabPanel(title = "Impact population",
strong(span(textOutput("message"), style="color:blue; font-size:24px", align = "center")),
numericInput(inputId = "nsim", label = "Nombre de simulations",
value = 50, min = 0, max = Inf, step = 10),
br(),
actionButton(inputId = "run", label = "Lancer l'analyse"),
hr(),
h4("Graphique : Impact relatif de chaque scnario", align = "center"),
plotOutput("graph_impact", width = "100%", height = "550px"),
hr(),
h4("Graphique : Trajectoire dmographique", align = "center"),
tabPanel(title = "Distribution paramtres",
h4("#Graphe licitation d'expert pour les mortalits", align = "center"),
h4("#Graphe licitation d'expert pour la taille de la population", align = "center"),
h4("#Graphe licitation d'expert pour la capacit de charge", align = "center"),
h4("#Graphe licitation d'expert pour la tendance de la population", align = "center"),
tabPanel(title = "Rapport",
br(),
radioButtons(inputId = "lifestyle",
h4("Mode de vie de l'espce"),
choices = c("Sdentaire", "Non-sdentaire nicheur", "Non-sdentaire hivernant", "Migrateur de passage")),
value = 5, min = 0, max = Inf, step = 1),
numericInput(inputId = "farm_number",
h4("Nombre de parcs"),
value = 1, min = 0, max = Inf, step = 1),
numericInput(inputId = "wind_turbines_2",
) # End tabPanel
) # End tabSetPanel
) # End mainPanel