I would like to copy the output result "my archive" (upload file name without extension) and use it in a function ( name( ) ) to read the column labels from a spreadsheet. It is possible?
Thanks for the help.
The code:
library(shiny)
ui <- fluidPage(
fileInput("archive", "upload file", accept = c(
".xlsx")),
textOutput("my_archive"),
textOutput("top"))
server <- function(input, output) {
csv <- reactive({
inFile <- input$archive
if (is.null(inFile))
return(NULL)
df<- read.xlsx(inFile$datapath, header=T)
return(df)
})
output$my_archive <- renderText({
# Test if file is selected
if (!is.null(input$x$datapath)) {
return(sub(".xlsx$", "", basename(input$archive$name)))
} else {
return(NULL)
}
})
output$top <-
renderPrint({
names("output$my_archive")
})
}
shinyApp(ui, server)