Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Impact démographique des collisions aviaires avec les éoliennes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CEFE
Interactions Humains-Animaux
Impact démographique des collisions aviaires avec les éoliennes
Commits
87d3ea1c
Commit
87d3ea1c
authored
3 years ago
by
thierrychambert
Browse files
Options
Downloads
Patches
Plain Diff
improve show hide on distri plots (all)
parent
efc8dc63
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inst/ShinyApp/server.R
+67
-21
67 additions, 21 deletions
inst/ShinyApp/server.R
with
67 additions
and
21 deletions
inst/ShinyApp/server.R
+
67
−
21
View file @
87d3ea1c
server
<-
function
(
input
,
output
,
session
){
server
<-
function
(
input
,
output
,
session
){
##--------------------------------------------
## Hide/Show : level 1
## Hide/Show : level 1
##--------------------------------------------
##--------------------------------------------
...
@@ -54,6 +54,7 @@ server <- function(input, output, session){
...
@@ -54,6 +54,7 @@ server <- function(input, output, session){
##--------------------------------------------
## Hide/Show : level 2
## Hide/Show : level 2
##--------------------------------------------
##--------------------------------------------
observe
({
observe
({
...
@@ -176,6 +177,7 @@ server <- function(input, output, session){
...
@@ -176,6 +177,7 @@ server <- function(input, output, session){
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
##--------------------------------------------
## Function to run the elicitation analysis
## Function to run the elicitation analysis
##----------------------------------------------
##----------------------------------------------
# Function to extract value from elicitation matrix and run the elication analysis
# Function to extract value from elicitation matrix and run the elication analysis
...
@@ -191,6 +193,7 @@ server <- function(input, output, session){
...
@@ -191,6 +193,7 @@ server <- function(input, output, session){
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
##--------------------------------------------
## Reactive value : simulation inputs
## Reactive value : simulation inputs
##--------------------------------------------
##--------------------------------------------
param
<-
reactiveValues
(
N1
=
NULL
,
param
<-
reactiveValues
(
N1
=
NULL
,
...
@@ -233,6 +236,7 @@ server <- function(input, output, session){
...
@@ -233,6 +236,7 @@ server <- function(input, output, session){
##--------------------------------------------
## Observe parameter values to be used in simulations run
## Observe parameter values to be used in simulations run
##----------------------------------------------------------
##----------------------------------------------------------
observe
({
observe
({
...
@@ -251,7 +255,7 @@ server <- function(input, output, session){
...
@@ -251,7 +255,7 @@ server <- function(input, output, session){
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
##--------------------------------------------
## Display parameter distribution
## Display parameter distribution
##--------------------------------------------
##--------------------------------------------
...
@@ -276,10 +280,7 @@ server <- function(input, output, session){
...
@@ -276,10 +280,7 @@ server <- function(input, output, session){
if
(
show_se
)
mtext
(
text
=
paste
(
"Erreur-type = "
,
round
(
se
,
2
)),
side
=
3
,
line
=
1
,
cex
=
1.2
,
adj
=
0
)
if
(
show_se
)
mtext
(
text
=
paste
(
"Erreur-type = "
,
round
(
se
,
2
)),
side
=
3
,
line
=
1
,
cex
=
1.2
,
adj
=
0
)
}
}
##----------------------
## Fatalities
## Fatalities
##----------------------
##----------------------
observeEvent
({
observeEvent
({
...
@@ -288,13 +289,13 @@ server <- function(input, output, session){
...
@@ -288,13 +289,13 @@ server <- function(input, output, session){
},{
},{
# Show from input values: if button is ON and input_type is set on "value"
# Show from input values: if button is ON and input_type is set on "value"
if
(
input
$
button_fatalities
%%
2
==
1
&
input
$
fatalities_input_type
==
"val"
){
if
(
input
$
button_fatalities
%%
2
==
1
&
input
$
fatalities_input_type
==
"val"
){
output
$
title_distri_plot
<-
renderText
({
"Mortalits annuelles"
})
output
$
title_distri_plot
<-
renderText
({
"Mortalits annuelles"
})
output
$
distri_plot
<-
renderPlot
({
plot_gamma
(
mu
=
input
$
fatalities_mean
,
se
=
input
$
fatalities_se
)
})
output
$
distri_plot
<-
renderPlot
({
plot_gamma
(
mu
=
input
$
fatalities_mean
,
se
=
input
$
fatalities_se
)
})
}
else
{
}
else
{
# Show from elicitation expert: if button is ON and input_type is set on "expert elicitation"
# Show from elicitation expert: if button is ON and input_type is set on "expert elicitation"
if
(
input
$
button_fatalities
%%
2
==
1
&
input
$
fatalities_input_type
==
"eli_exp"
){
if
(
input
$
button_fatalities
%%
2
==
1
&
input
$
fatalities_input_type
==
"eli_exp"
){
if
(
!
is.null
(
param
$
fatalities_eli_result
)){
if
(
!
is.null
(
param
$
fatalities_eli_result
)){
output
$
title_distri_plot
<-
renderText
({
"Mortalits annuelles"
})
output
$
title_distri_plot
<-
renderText
({
"Mortalits annuelles"
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
fatalities_eli_result
$
out
)
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
fatalities_eli_result
$
out
)
})
}
else
{
}
else
{
output
$
title_distri_plot
<-
NULL
output
$
title_distri_plot
<-
NULL
...
@@ -309,24 +310,69 @@ server <- function(input, output, session){
...
@@ -309,24 +310,69 @@ server <- function(input, output, session){
},
ignoreInit
=
FALSE
)
},
ignoreInit
=
FALSE
)
##----------------------
## Population size ###~~~~~~~~~~~~~~~~~~~~~~~~~~###
## Population size
##----------------------
observeEvent
({
observeEvent
({
input
$
pop_size_input_type
input
$
pop_size_input_type
input
$
button_pop_size
input
$
button_pop_size
},{
},{
output
$
title_distri_plot
<-
renderText
({
"Taille de population"
})
# Show from input values: if button is ON and input_type is set on "value"
output
$
distri_plot
<-
renderPlot
({
plot_gamma
(
mu
=
input
$
pop_size_mean
,
se
=
input
$
pop_size_se
)
})
if
(
input
$
button_pop_size
%%
2
==
1
&
input
$
pop_size_input_type
==
"val"
){
},
ignoreInit
=
TRUE
)
output
$
title_distri_plot
<-
renderText
({
"Taille initiale de la population"
})
output
$
distri_plot
<-
renderPlot
({
plot_gamma
(
mu
=
input
$
pop_size_mean
,
se
=
input
$
pop_size_se
)
})
}
else
{
# Show from elicitation expert: if button is ON and input_type is set on "expert elicitation"
if
(
input
$
button_pop_size
%%
2
==
1
&
input
$
pop_size_input_type
==
"eli_exp"
){
if
(
!
is.null
(
param
$
pop_size_eli_result
)){
output
$
title_distri_plot
<-
renderText
({
"Taille initiale de la population"
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
pop_size_eli_result
$
out
)
})
}
else
{
output
$
title_distri_plot
<-
NULL
output
$
distri_plot
<-
NULL
}
# Hide otherwise (when button is OFF)
}
else
{
output
$
title_distri_plot
<-
NULL
output
$
distri_plot
<-
NULL
}
}
},
ignoreInit
=
FALSE
)
## Population growth ###~~~~~~~~~~~~~~~~~~~~~~~~~~###
##----------------------
## Population growth
##----------------------
observeEvent
({
observeEvent
({
input
$
pop_growth_input_type
input
$
pop_growth_input_type
input
$
button_pop_growth
input
$
button_pop_growth
},{
},{
output
$
title_distri_plot
<-
renderText
({
"Taux de croissance de la population"
})
# Show from input values: if button is ON and input_type is set on "value"
output
$
distri_plot
<-
renderPlot
({
plot_gamma
(
mu
=
input
$
pop_growth_mean
,
se
=
input
$
pop_growth_se
)
})
if
(
input
$
button_pop_growth
%%
2
==
1
&
input
$
pop_growth_input_type
==
"val"
){
},
ignoreInit
=
TRUE
)
output
$
title_distri_plot
<-
renderText
({
"Taux de croissance de la population"
})
output
$
distri_plot
<-
renderPlot
({
plot_gamma
(
mu
=
input
$
pop_growth_mean
,
se
=
input
$
pop_growth_se
)
})
}
else
{
# Show from elicitation expert: if button is ON and input_type is set on "expert elicitation"
if
(
input
$
button_pop_growth
%%
2
==
1
&
input
$
pop_growth_input_type
==
"eli_exp"
){
if
(
!
is.null
(
param
$
pop_growth_eli_result
)){
output
$
title_distri_plot
<-
renderText
({
"Taux de croissance de la population"
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
pop_growth_eli_result
$
out
)
})
}
else
{
output
$
title_distri_plot
<-
NULL
output
$
distri_plot
<-
NULL
}
# Hide otherwise (when button is OFF)
}
else
{
output
$
title_distri_plot
<-
NULL
output
$
distri_plot
<-
NULL
}
}
},
ignoreInit
=
FALSE
)
##----------------------
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~###
...
@@ -357,7 +403,7 @@ server <- function(input, output, session){
...
@@ -357,7 +403,7 @@ server <- function(input, output, session){
param
$
fatalities_eli_result
<-
func_eli
(
input
$
fatalities_mat_expert
)
param
$
fatalities_eli_result
<-
func_eli
(
input
$
fatalities_mat_expert
)
## plot distribution
## plot distribution
output
$
title_distri_plot
<-
renderText
({
"Mortalits annuelles"
})
output
$
title_distri_plot
<-
renderText
({
"Mortalits annuelles"
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
fatalities_eli_result
$
out
)
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
fatalities_eli_result
$
out
)
})
}
else
{
}
else
{
...
@@ -376,7 +422,7 @@ server <- function(input, output, session){
...
@@ -376,7 +422,7 @@ server <- function(input, output, session){
param
$
pop_size_eli_result
<-
func_eli
(
input
$
pop_size_mat_expert
)
param
$
pop_size_eli_result
<-
func_eli
(
input
$
pop_size_mat_expert
)
## plot distribution
## plot distribution
output
$
title_distri_plot
<-
renderText
({
"Taille de population"
})
output
$
title_distri_plot
<-
renderText
({
"Taille de population"
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
pop_size_eli_result
$
out
)
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
pop_size_eli_result
$
out
)
})
}
else
{
}
else
{
...
@@ -395,7 +441,7 @@ server <- function(input, output, session){
...
@@ -395,7 +441,7 @@ server <- function(input, output, session){
param
$
pop_growth_eli_result
<-
func_eli
(
input
$
pop_growth_mat_expert
)
param
$
pop_growth_eli_result
<-
func_eli
(
input
$
pop_growth_mat_expert
)
## plot distribution
## plot distribution
output
$
title_distri_plot
<-
renderText
({
"Taux de croissance de la population"
})
output
$
title_distri_plot
<-
renderText
({
"Taux de croissance de la population"
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
pop_growth_eli_result
$
out
)
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
pop_growth_eli_result
$
out
)
})
}
else
{
}
else
{
...
@@ -413,7 +459,7 @@ server <- function(input, output, session){
...
@@ -413,7 +459,7 @@ server <- function(input, output, session){
param
$
carrying_cap_eli_result
<-
func_eli
(
input
$
carrying_cap_mat_expert
)
param
$
carrying_cap_eli_result
<-
func_eli
(
input
$
carrying_cap_mat_expert
)
## run elicitation analysis
## run elicitation analysis
output
$
title_distri_plot
<-
renderText
({
"Capacit de charge"
})
output
$
title_distri_plot
<-
renderText
({
"Capacit de charge"
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
carrying_cap_eli_result
$
out
,
show_se
=
FALSE
)
})
output
$
distri_plot
<-
renderPlot
({
plot_expert
(
param
$
carrying_cap_eli_result
$
out
,
show_se
=
FALSE
)
})
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment