我可以让文件输入后fileInput小部件消失吗?或者我可以摆脱蓝色进度条吗?
谢谢!
答案 0 :(得分:3)
HelloStéphaneLaurent回答了一个类似的问题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)
}
))