Hello all,
I am trying to understand why it takes 20-30 seconds to upload my csv file using Shiny. The file is 20 MB. I tried using read.csv and fread -- both takes > 20 seconds.
Here are the codes. Any advide is greatly appreciated.
ui.R
shiny::fluidPage(title = "Hello",
shiny::navbarPage("Input", id = "allResults",
shiny::tabPanel(value = 'inputData', title = 'Data Import',
br(),
h4("Import data"),
shiny::fileInput(inputId = "inFile", "Choose a CSV File",
accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv"
)
),
shiny::checkboxInput("header", "Header", TRUE)
)
)
)
server.R
options(shiny.maxRequestSize = 5*1024^3)
function(input, output, session) {
rawdata <- shiny::eventReactive (input$inFile, {
rdata <- read.csv(input$inFile$datapath, header=input$header, sep=",")
#rdata <- data.table::fread(input$inFile$datapath, header=input$header, sep=",", data.table = F)
})
}