Actualiser app.R

This commit is contained in:
aslane 2024-03-21 11:26:53 +00:00
parent 9f1e49a248
commit 275f4b4ef8
1 changed files with 25 additions and 27 deletions

52
app.R
View File

@ -69,19 +69,9 @@ comparisonGraph = function(emmeansObj, prefix="hypothèse", groupe=T){
ui <- fluidPage(
useShinyjs(),
# Ici on empêche l'utilisateur de pouvoir rafraîchir la page accidentellement
tags$script('
window.onbeforeunload = function() {
return "Voulez-vous vraiment quitter cette page ?";
};
'),
#theme = shinytheme("readable"),
navbarPage(
"Stat Plateform",
"StatPlat",
tabPanel("Accueil",
fluidRow(
column(4,
@ -173,15 +163,17 @@ ui <- fluidPage(
fluidRow(
column(4,
wellPanel(
selectizeInput("khi2_cat","Choisir les variables",multiple = TRUE,choices = NULL),
selectizeInput("khi2_x","Choisir une variable",multiple = FALSE,choices = NULL),
selectizeInput("khi2_y","Choisir une autre variable",multiple = FALSE,choices = NULL),
actionButton("khi2_button", "KHI2",class="btn-primary")
)
),
column(8,
wellPanel(
style = 'overflow-x: scroll;height: 650px;',
DT::dataTableOutput("khi2_table"),
downloadButton("khi2_button_download", "Télécharger le tableau",class="btn-primary")
#style = 'overflow-x: scroll;height: 650px;',
#DT::dataTableOutput("khi2_table"),
verbatimTextOutput("khi2_result")
#downloadButton("khi2_button_download", "Télécharger le tableau",class="btn-primary")
)
)
)
@ -207,14 +199,7 @@ ui <- fluidPage(
)
)
)
),
tabPanel("Instructions",
fluidRow(
column(8,
includeMarkdown("README.md")
)
)
),
),
navbarMenu("Régressions",
tabPanel("ACP",
column(3,
@ -267,7 +252,8 @@ server <- function(input, output, session) {
})
# Partie permettant de fusionner les fichiers
observe({
merged_data <- eventReactive(input$files, {
# On lit la liste des fichiers et on les fusionne
# Charger les données à partir des fichiers sélectionnés
@ -397,10 +383,10 @@ server <- function(input, output, session) {
choices = colnames( merged_data_type() %>% select_if(function(x) is.numeric(x) || is.integer(x))))
updateSelectInput(session, "var_explicatives_kw",
choices = colnames( merged_data_type() %>% select_if(function(x) is.factor(x))))
updateSelectInput(session, "khi2_cat",
updateSelectInput(session, "khi2_x",
choices = colnames( merged_data_type() %>% select_if(function(x) is.factor(x))))
updateSelectInput(session, "khi2_y",
choices = colnames( merged_data_type() %>% select_if(function(x) is.factor(x))))
updateSelectInput(session, "khi2_num",
choices = colnames( merged_data_type() %>% select_if(function(x) is.numeric(x) || is.integer(x))))
})
#On utilise une fonction permettant d'obternir la liste des variables numériques
@ -622,6 +608,17 @@ server <- function(input, output, session) {
)
khi2_table_calc <- eventReactive(input$khi2_button,{
x <- input$khi2_x
y <- input$khi2_y
merged_data <- merged_data_type()
khi2_table <- table(merged_data[,x],merged_data[,y])
res <- chisq.test(khi2_table)
return(res)
})
output$khi2_result <- renderPrint(khi2_table_calc())
anova_table <- eventReactive(input$anova_button,{
tryCatch({
@ -924,6 +921,7 @@ server <- function(input, output, session) {
#output$pls_text <- renderText({'print'})
})
}
shinyApp(ui, server)