[英]What is the best way to create the user library directory set in .Renviron?
[英]What is the best way to have "holding text" before user input?
如果這在某處被記錄,我很抱歉,但我一直在努力找到任何有用的東西。
我有一個閃亮的應用程序,用戶上傳一個.csv
文件,然后使用DT::renderDataTable()
和DT::dataTableOutput()
出現在 UI 中。 在用戶實際上傳文件之前,在此面板中顯示一些保留文本(例如“請上傳 csv”)的最佳方法是什么?
謝謝。
validate
功能似乎與您想要的相對應。 檢查此處以了解更多詳細信息並自定義錯誤消息。
您需要在以下示例中上傳 Excel 文件:
library(shiny)
library(DT)
library(readxl)
ui <- fluidPage(
titlePanel("Example"),
sidebarPanel(
fileInput("upload", "Upload a file")
),
mainPanel(
dataTableOutput("table")
)
)
server <- function(input, output, session) {
output$table <- renderDataTable({
validate(need(input$upload != "", "Please select a data set"))
read_xlsx(input$upload$datapath, sheet = 1)
})
}
shinyApp(ui = ui, server = server)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.