Fail to upload large csv file


#1

Hello,

I have an app to upload csv files for model training. When I tested it locally with small (2 MB) and large (200 MB) files uploaded, there was no issue. But after publishing it to shinyapps.io, I got the following error while uploading the large file:

<!doctype html> <!–[if lt IE 7 ]> <html lang=“en” class=“no-js ie6”

Code to upload files:

ui:

ui <-shinyUI(fluidPage(
titlePanel(“File Input & Model Training”),
sidebarLayout(
sidebarPanel(
fileInput(“file”,“Upload the training file”), # fileinput() function is used to get the file upload contorl option
helpText(“Default max. file size is 600 MB”),
tags$hr(),
fileInput(“file2”,“Upload the test file”), # fileinput() function is used to get the file upload contorl option
tags$hr(),
h5(helpText(“Select the read.table parameters below”)),
checkboxInput(inputId = ‘header’, label = ‘Header’, value = FALSE),
checkboxInput(inputId = “stringAsFactors”, “stringAsFactors”, FALSE),
br(),
radioButtons(inputId = ‘sep’, label = ‘Separator’, choices = c(Comma=’,’,Semicolon=’;’,Tab=’\t’, Space=’’), selected = ‘,’),
tags$hr(),…

Server:

server<-function(input,output){

data <- reactive({
file1 <- input$file
if(is.null(file1)){return()}
read.table(file=file1$datapath, sep=input$sep, header = input$header, stringsAsFactors = input$stringAsFactors)
})

data2 <- reactive({
file3 <- input$file2
if(is.null(file3)){return()}
read.table(file=file3$datapath, sep=input$sep, header = input$header, stringsAsFactors = input$stringAsFactors)
})…

I am using a free account and there was no issue with uploading the smaller files.

Is it because I don’t have enough memory to deal with file uploading? Or anything other thing I can do to fix it?

Thank you.


#2

I had issues loading a large .csv file into R-Markdown and ended up using fread() instead of read.csv. I found my load time a lot quicker that way.

I believe in Shiny you can also use fread() for a more optimal performance coming to speed and size. There's a StackOverflow post about that here: https://stackoverflow.com/questions/33121634/fread-performance-and-shinnyapp