r Shiny : make fileInput widget disappear after file input

标签 r widget shiny

我可以让 fileInput 小部件在文件输入后消失吗?或者我可以去掉蓝色进度条吗?

谢谢!

最佳答案

你好 Stéphane Laurent 回答了类似的问题 in this post ,它给出了一个最小的例子:

data("kyphosis", package = "rpart")
write.table(kyphosis, file = "kyphosis.txt", row.names = FALSE)


library(shiny)
runApp(list(
  ui = pageWithSidebar(
    headerPanel = headerPanel(" "),
    sidebarPanel = sidebarPanel( conditionalPanel(condition = "output.fileUploaded",
                                                  fileInput(inputId = "file_input", label = "Input" ) )),
    mainPanel = mainPanel( tableOutput(outputId = "table"))
  ),
  server = function(input, output) {

  getData <- reactive({
    if(is.null(input$file_input)) {
      return(NULL)
    } else {
      return(read.table(input$file_input$datapath, header = TRUE))
    }
  })

  output$fileUploaded <- reactive({
    return(is.null(getData()))
  })

  output$table <- renderTable({
    head(getData())
  })
  outputOptions(output, 'fileUploaded', suspendWhenHidden=FALSE)
  }
))

关于r Shiny : make fileInput widget disappear after file input,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25906237/

相关文章:

r - 根据 R Shiny 中的其他选择动态更新两个 selectInput 框

r - 在ggplot2 boxplot上添加多个标签

r - Pivot_wider/spread 而不是 value_from 或值只是 1?

具有多个按钮的android小部件

R传单和 Shiny 如何清除 map 点击数据

r - 取 dplyr 中字符串定义的变量的平均值

html - 保护 iFrame - 只允许它在一个域上工作

html - 修改预装 WordPress 小部件的外观

r - 单击同一按钮之间的时间间隔 - shiny R

r - 如何根据 Shiny 的输入选择对数据框进行子集化并使用传单进行绘图