スキップしてメイン コンテンツに移動
このブログを検索/Search this blog
ShinyでFileがUploadされているとdatapathを表示して、UploadされていないとNoneと返すスクリプト
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
fileInput(“upload”, NULL, buttonLabel = “Upload”, multiple = FALSE),
actionButton(“action_button”, “Run”),
textOutput(“files”)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
observeEvent(input$action_button,{
if(!is.null(input$upload)){
output$files <- renderText(input$upload$datapath)
}
else{
output$files <- renderText(“None”)
}
}
)
}
# Run the application
shinyApp(ui = ui, server = server)