reactalValueとグローバル変数の違いは何ですか?グローバル変数とリアクティブ値の差
私は、正しい答えを見つけることができません:/と私は私の次のスクリプトでは、問題を持っている:
shinyServer(function(input, output, session) {
global <- list()
observe({
updateSelectInput(session, "choixDim", choices = param[name == input$choixCube, dim][[1]])
updateSelectInput(session, "choixMes", choices = param[name == input$choixCube, mes][[1]])
})
output$ajoutColonneUi <- renderUI({
tagList(
if(input$ajoutColonne != "Aucun"){
textInput("nomCol", "Nom de la colonne créée")
},
switch(input$ajoutColonne,
"Ratio de deux colonnes" = tagList(
selectInput("col1", label = "Colonne 1", choices = input$choixMes),
selectInput("col2", label = "Colonne 2", choices = input$choixMes)
),
"Indice base 100" = selectInput("col", label = "Colonne", choices = input$choixMes),
"Evolution" = selectInput("col", label = "Colonne", choices = input$choixMes)
)
)
})
observeEvent(input$chargerCube,{
debutChargement()
global <- creerCube(input)
global <- ajouterColonne(global, input)
finChargement()
if(!is.null(global)){
cat('Cube chargé avec succés ! \n')
output$handlerExport <- downloadHandler(
filename = function(){
paste0("cube_generated_with_shiny_app",Sys.Date(),".csv")
},
content = function(file){
fwrite(global$cube, file, row.names = FALSE)
}
)
output$boutons <- renderUI({
tagList(
downloadButton("handlerExport", label = "Exporter le cube"),
actionButton("butValider", "Rafraichir la table/le graphique")
)
})
}
})
observeEvent(input$butValider,{
output$pivotTable <- renderRpivotTable({
cat('test')
rpivotTable(data = global$cube, aggregatorName = "Sum", vals = global$mes[1], cols = global$temp)
})
})
})
グローバルが更新されていない私は、これらのデータからrpivotTableを表示したいとき...
反応変数は有用ですが、グローバル変数の値を更新する必要がある場合は、反応式やサブ関数内で '< - 'の代わりに '< - '演算子を使用してください。 – Geovany