gpt4 book ai didi

r Shiny : make fileInput widget disappear after file input

转载 作者:行者123 更新时间:2023-12-01 23:52:06 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com