0
私はプリントとプロットという2つの出力を持っています。実行ボタンが押された(作業中)後に印刷を実行し、印刷が完了したらプロットパートが実行されます。別の仕上げの後に光沢のある反応を起こしてください
この理由は、印刷部分が数分かかるため、その出力はplotコマンドに行く必要があるからです。
簡単な例:
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
actionButton('run','Run')
),
mainPanel(
verbatimTextOutput("Descriptive"),
plotOutput("plotData",width = "700px", height = "500px")
)
)
)
server <- function(input, output) {
output$Descriptive <- renderPrint({
if(input$run>0){
return(isolate({
cat('Number of rows:', nrow(mtcars))
mpg2 <<- mtcars$mpg+3
cyl2 <<- mtcars$cyl+3
}))
}else{return(invisible())}
})
#### RUN AFTER DESCRIPTIVE COMPLETES ####
output$plotData <- renderPlot({
plot(mpg2,cyl2)
})
}
shinyApp(ui = ui, server = server)
あなたの出力は、次に使用することができ、反応式にあなたの計算をオンにします。計算が変更されると、その計算に依存する出力が自動的に更新されます。 https://shiny.rstudio.com/articles/reactivity-overview.htmlを一目で把握できます –