【问题标题】:Showing progress bar in Shiny application在 Shiny 应用程序中显示进度条
【发布时间】:2018-11-06 18:31:45
【问题描述】:

我正在尝试在 Shiny 应用程序中显示进度条或消息。我有 app.R 和 helpcode.R

app.r

ui <- dashboardPage(
    column(width =3, numericInput('days','Days less than','15', width = 100)),
    submitButton("Submit")
    )

帮助代码.R

new_function(input){
t_1 <- read.table("data/data_1.txt",sep="\t",skip=1)
  t_2 <- read.table("data/data_2.txt",sep="\t",skip=1)
}

我想显示状态消息,例如 - 函数读取数据1时加载数据1 函数读取数据2时加载数据2

我不知道该怎么做。

【问题讨论】:

  • 这是为了调试目的吗? AFAIK fileInput 已经提供了各种上传指示器。
  • @r2evans 我无法在此与Progress 集成。
  • @RomanLuštrik 不用于调试。我没有将文件作为输入,文件是通过我的笔记本电脑中已经存在的函数读取的。
  • 也尝试使用操作按钮

标签: r shiny


【解决方案1】:

您可以在new_function 中使用withProgress 元素

new_function(input) {
  withProgress(message = "Loading Data 1", value = 1, {
    t_1 <- read.table("data/data_1.txt",sep="\t",skip=1)
  })
  withProgress(message = "Loading Data 2", value = 1, {
    t_2 <- read.table("data/data_2.txt",sep="\t",skip=1)
  })
}

【讨论】:

    猜你喜欢
    • 2021-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多