Commit 509a4378 authored by Falipou Eva's avatar Falipou Eva
Browse files

Nouvelle version avec possibilité de commenter les résultats et de les...

Nouvelle version avec possibilité de commenter les résultats et de les exporter dans un fichier word
No related merge requests found
Showing with 48 additions and 5 deletions
+48 -5
......@@ -4,6 +4,7 @@ library(dplyr)
library(rhandsontable)
library(data.table)
library(numDeriv)
library(gridExtra)
ln_lineaire <- function(labvdep,don,zm,zd,alpha){
......@@ -353,7 +354,13 @@ ui <- fluidPage(
h3("Choose quantile (%)"),
numericInput("alpha", "Quantile", min=1, value=50, max=100),
actionButton("run", "Show results")),
actionButton("run", "Show results"),
br(),
br(),
br(),
h3("Download results"),
textInput("title","Document title","Results"),
downloadButton("download","Download")),
# Main panel for displaying outputs ----
......@@ -365,6 +372,7 @@ ui <- fluidPage(
br(),
p(strong("> Select the csv file containing the data to be analyzed")),
p("It has to be a csv file with semicolon separator"),
p("The file should contain the different dependent variables (ex : TSS, CDO, BDO,...) and the different explanatory variables with corresponding column headers (ex: facility, age group,...)"),
br(),
p(strong("> Choose the dependent variable")),
p("For example TSS"),
......@@ -386,7 +394,10 @@ ui <- fluidPage(
br(),
p(strong("> Choose the quantile you want to be returned by the model")),
br(),
p(strong("> Lauch the model by clicking on the 'Show results' button. The table of estimates and the table of quantiles appear in the 'Results' panel."))
p(strong("> Lauch the model by clicking on the 'Show results' button. The table of estimates and the table of quantiles appear in the 'Results' panel.")),
br(),
p(strong("> Export results")),
p("It is finaly possible to comment the results (dataset used, reference set, conclusions,...) and to export them in a word file using the 'Download' button (with a title choosen by the user).")
),
tabPanel("Data Table",
......@@ -401,7 +412,12 @@ ui <- fluidPage(
h3("> Quantiles"),
textOutput("lab_quant"),
dataTableOutput("quantile"))
dataTableOutput("quantile"),
h3("Comment"),
tags$textarea(id="description", rows=6, cols=80,))
)
)
)
......@@ -410,7 +426,7 @@ ui <- fluidPage(
# server
server <- function(input, output) {
#Reactive values
values <- reactiveValues(mat=NULL, don=NULL)
# Importation du fichier de donnees
......@@ -503,7 +519,7 @@ server <- function(input, output) {
observeEvent(input$run,{
outputs <- ln_lineaire(labvdep=input$var,don=values$don,zm=input$median,zd=input$disp,alpha=input$alpha/100)
# return table of estimates
output$lab_res <- renderText({
paste("Parameter: ",isolate(input$var),"\n")
......@@ -516,6 +532,33 @@ server <- function(input, output) {
paste("Dependent variable: ",isolate(input$var)," - Table of observed and theoretical ",input$alpha,"% quantiles:\n")
})
output$quantile <- renderDataTable(outputs[[2]], options = list(dom = 't', searching = FALSE))
output$download <- downloadHandler(
filename = function(){paste0(input$title, ".doc")},
content = function(file) {
# Copy the report file to a temporary directory before processing it, in
# case we don't have write permissions to the current working dir (which
# can happen when deployed).
tempReport <- file.path(tempdir(), "results.Rmd")
file.copy("results.Rmd", tempReport, overwrite = TRUE)
# Set up parameters to pass to Rmd document
params <- list(description = input$description,
estimates = outputs[[1]],
quantile = outputs[[2]]
)
# Knit the document, passing in the `params` list, and eval it in a
# child of the global environment (this isolates the code in the document
# from the code in this app).
rmarkdown::render(tempReport,
output_file = file,
params = params,
envir = new.env(parent = globalenv())
)
}
)
})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment