Last active
April 2, 2024 09:21
-
-
Save stephlocke/c3299992ef3ac3efe1f978bd1cb0b4b2 to your computer and use it in GitHub Desktop.
Demo shiny app for multiple file uploads and a single read step
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(data.table) | |
ui <- fluidPage( | |
titlePanel("Multiple file uploads"), | |
sidebarLayout( | |
sidebarPanel( | |
fileInput("csvs", | |
label="Upload CSVs here", | |
multiple = TRUE) | |
), | |
mainPanel( | |
textOutput("count") | |
) | |
) | |
) | |
server <- function(input, output) { | |
mycsvs<-reactive({ | |
rbindlist(lapply(input$csvs$datapath, fread), | |
use.names = TRUE, fill = TRUE) | |
}) | |
output$count <- renderText(nrow(mycsvs())) | |
} | |
shinyApp(ui = ui, server = server) |
I added a step to view the data in a table, but it seems that the files (xlsx) are not actually combining. I am simply uploading a new file each time. Is there a step I am missing that combines each file I upload? Thank you so much for this demo!
You may need to ctrl+click the files @piercefa you want to upload when in your file explorer window that pops up
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much !!!!