我可以让 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/