Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my googleVis chart causing a "R encountered a fatal error" when trying to upload 5+MB files in R Shiny?
    primarykey
    data
    text
    <p>I am making an app using R Shiny. I put this command at the top of my program:</p> <pre><code>options(shiny.maxRequestSize=-1) </code></pre> <p>Apparently this command allows the user to upload any file size (default is 5 MB limit). I've also tried:</p> <pre><code>options(shiny.maxRequestSize=30*1024^2) </code></pre> <p>which I believe is a 30 MB limit.</p> <p>However, whenever I try to upload a file larger than 5 MB, R crashes and I get a "R encountered a fatal error" message about a minute after trying to load the file.</p> <p>EDIT: Further testing has shown that the gVis table I am outputting is causing the crash. Why might this be?</p> <p>My code works fine for any file under 5 MB.</p> <p>Some code:</p> <p>ui.R</p> <pre><code>dataset &lt;- list('Upload a file'=c(1)) shinyUI(pageWithSidebar( sidebarPanel( fileInput('file', 'Data file'), radioButtons('format', 'Format', c('CSV', 'TSV')), conditionalPanel(condition = "input.tsp == 'sort'", checkboxInput(inputId = "pageable", label = "Make table pageable"), conditionalPanel("input.pageable==true", numericInput(inputId = "pagesize", label = "Entries per page",10)) ), conditionalPanel(condition = "input.tsp == 'multi' ", selectInput('x', 'X', names(dataset)), selectInput('y', 'Y', names(dataset), multiple=T), selectInput('color', 'Color', c('None', names(dataset))), checkboxInput('jitter', 'Jitter'), checkboxInput('smooth', 'Smooth'), selectInput('facet_row', 'Facet Row', c(None='.', names(dataset))), selectInput('facet_col', 'Facet Column', c(None='.', names(dataset))) ) ), mainPanel( tabsetPanel( tabPanel("Sortable Table", htmlOutput("gvisTable"),value="sort"), tabPanel("Multiplot", plotOutput('plotMulti'), value="multi"), id="tsp" #id of tab ) ) )) </code></pre> <p>server.R</p> <pre><code>library(reshape2) library(googleVis) library(ggplot2) options(shiny.maxRequestSize=-1) shinyServer(function(input, output, session) { #----------------------------------------------------------- # Dataview Tab Inputs #----------------------------------------------------------- data &lt;- reactive({ if (is.null(input$file)) return(NULL) else if (identical(input$format, 'CSV')) return(read.csv(input$file$datapath)) else return(read.delim(input$file$datapath)) }) observe({ df &lt;- data() str(names(df)) if (!is.null(df)) { updateSelectInput(session, 'x', choices = names(df)) updateSelectInput(session, 'y', choices = names(df)) updateSelectInput(session, 'color', choices = c('None', names(df))) updateSelectInput(session, 'facet_row', choices = c(None='.', names(df))) updateSelectInput(session, 'facet_col', choices = c(None='.', names(df))) } }) myOptions &lt;- reactive({ list( page=ifelse(input$pageable==TRUE,'enable','disable'), pageSize=input$pagesize, width=1000 ) }) output$gvisTable &lt;- renderGvis( { if (is.null(data())) return(NULL) gvisTable(data(), options=myOptions()) }) #----------------------------------------------------------- # Graphs #----------------------------------------------------------- output$plotMulti &lt;- renderPlot({ if (is.null(data())) return(NULL) temp &lt;- input$x p &lt;- ggplot(data(), aes_string(x=temp, y=input$y), environment = environment()) p &lt;- p + geom_bar() if (input$smooth) p &lt;- p + geom_smooth() if (input$color != 'None') p &lt;- p + aes_string(color=input$color) facets &lt;- paste(input$facet_row, '~', input$facet_col) if (facets != '. ~ .') p &lt;- p + facet_grid(facets) if (input$jitter) p &lt;- p + geom_jitter() multiplot(p, p) }) }) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload