我在一个共享驱动器(K:\\Market Risk\\R\\Scripts\\)中保存了一个非常简单的测试脚本(Test.R),我想从一个闪亮的应用程序中调用它。
rm(list=ls())
Sys.sleep(5)在我的应用程序中,我编写了一个函数来调用脚本,并向应用程序用户显示该函数是否正在运行;该函数按预期自行运行。
run_test <- function() {
print("Running...")
source("K:\\Market Risk\\R\\Scripts\\Test.R", local = T)
print("Complete")
}然而,当在我的应用程序上部署时,文本输出只有在它完成运行和“运行...”时才会显示“完成”。仅显示在我的控制台中,而不是应用程序中。
library(shiny)
run_test <- function() {
print("Running...")
source("K:\\Market Risk\\R\\Scripts\\Test.R", local = T)
print("Complete")
}
ui <- fluidPage(
tabsetPanel(
tabPanel("Reporting",
br(),
verticalLayout(
fluidRow(strong("Test"),
actionButton("Run_Test", "Run"),
textOutput("text")
)
)
)
)
)
server <- function(input, output) {
observeEvent(input$Run_Test, {
output$text <- renderText(run_test())
})
}
shinyApp(ui = ui, server = server)以前有没有人经历过这种情况?
发布于 2019-08-17 01:01:01
多亏了@r2evans,我能够在这里找到我需要的示例代码:https://github.com/daattali/advanced-shiny/blob/master/show-warnings-messages/app.R
https://stackoverflow.com/questions/57516832
复制相似问题