I am trying to make a simple program to load and display the contents of a CSV file in Shiny. I copied an example of downloading files from a brilliant website, but it did not work. The output table simply displays "X.object.Object". and I get warnings:
Warning in read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on '/var/folders/2d/2vmslzld48xf_y40rjg3sry00000gp/T//RtmpRLx4Va/aa2cf08f688d80f5d1fd5209/0' Warning in matrix(align.tmp[(2 - pos):(ncol(x) + 1)], nrow = nrow(x), ncol = ncol(x) + : data length exceeds size of matrix
I made some additional elements to display the object file from the input Shiny boot file and the result of file.info along the path to the file specified by it. The Shiny input object looks great (it determines the type and size of the file correctly), but file.info says that it has a length of only 15 bytes, if it should be several kilobytes. Using readChar to get the contents of a file as a simple line also does not work. Reading a file using read.csv or readChar from the console works fine. I think that somehow it does not save the file correctly when it is downloaded. How can I check this?
ui.R:
shinyUI(fluidPage( titlePanel("Uploading Files"), sidebarLayout( sidebarPanel( fileInput('file1', 'Choose file to upload', accept = c( 'text/csv', 'text/comma-separated-values', 'text/tab-separated-values', 'text/plain', '.csv', '.tsv' ) ), tags$hr(), checkboxInput('header', 'Header', TRUE), radioButtons('sep', 'Separator', c(Comma=',', Semicolon=';', Tab='\t'), ','), radioButtons('quote', 'Quote', c(None='', 'Double Quote'='"', 'Single Quote'="'"), '"') ), mainPanel( tableOutput('contents'), tableOutput('stuff1'), tableOutput('stuff2'), textOutput('moreStuff') ) ) ))
server.R
# By default, the file size limit is 5MB. It can be changed by