Cannot deploy ShinyApp: incomplete final line found by readTableHeader on 'raw' (Using default: en_US)

Viewed 1313

I have been desperately trying to deploy my shinyApp for about a week now but unfortunately I can't stop getting the following message :

Warning message: Error detecting locale: Error in read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'raw' (Using default: en_US)

I took a look at the debugging Shiny app page and I used the "showcase mode" in order to try to track down the potential issues in my script. But when I run the "showcase mode" code (shiny::runApp(display.mode="showcase")) in local I get this warning message:

Warning: Error in file.path: cannot coerce type 'closure' to vector of type 'character'

As YBS explained it in the comments, this error is actually a bug in shiny but then I don't see how I can debug my script in order to deploy my app (I already tried to add an empty line at the end of each of my csv files but it didn't help)

Did someone already face this issue ?

My app: https://gitlab.com/wanderzen/shiny_app/-/blob/master/ZABR.rar

NB: my app works like a charm in local if I used shinyApp(ui, server)

Here are some info about my session :

# sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                   LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] sp_1.4-1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6        BiocManager_1.30.10 compiler_4.0.0      pillar_1.4.4       
 [5] later_1.0.0         tools_4.0.0         packrat_0.5.0       digest_0.6.25      
 [9] jsonlite_1.6.1      tibble_3.0.1        lifecycle_0.2.0     lattice_0.20-41    
[13] pkgconfig_2.0.3     rlang_0.4.9         shiny_1.4.0.2       rstudioapi_0.11    
[17] curl_4.3            xfun_0.13           fastmap_1.0.1       dplyr_0.8.5        
[21] htmlwidgets_1.5.1   vctrs_0.3.0         askpass_1.1         grid_4.0.0         
[25] DT_0.16             tidyselect_1.1.0    glue_1.4.1          R6_2.4.1           
[29] purrr_0.3.4         magrittr_1.5        promises_1.1.0      ellipsis_0.3.1     
[33] htmltools_0.5.0     rsconnect_0.8.16    assertthat_0.2.1    mime_0.9           
[37] xtable_1.8-4        httpuv_1.5.2        tinytex_0.23        openssl_1.4.1      
[41] crayon_1.3.4       

# packageVersion("shiny")
[1] ‘1.4.0.2’ 
2 Answers

It took me quite some time to debug my application fluidrow by fluidrow but I eventually found out what was causing all the trouble !

I had been using both dplyr::filter(variable== input$variable) and filter((variable == input$variable) in my script until I realized their conflict was behind the malfunction of my shiny app.

https://github.com/STAT545-UBC/Discussion/issues/331#issuecomment-249048018

I guess that the problem doesn't come from Shiny but from different Locale settings between your local test machine and the Shiny server you're trying to deploy the app on.

The script you shared shows that you use six times read.csv, and the error you get looks like 'Incomplete final line' warning when trying to read a .csv file into R

First of all, I would try to use read.csv2 instead of read.csv because it is better suited for French settings, see doc :

  • separator ;
  • decimal separator ,

If this isn't enough, one of the files you're trying to load lacks an EOL on the last line.

The work around is to insert readLines into read.csv2:

read.csv2(text = readLines("yourfilename.csv", warn = FALSE),header=T) 

Related