无法部署 ShinyApp:readTableHeader 在“raw”上发现不完整的最后一行(使用默认值:en_US)

2024-05-17

我已经拼命尝试部署我的闪亮应用程序大约一周了,但不幸的是我无法停止收到以下消息:

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)

我看了一下调试闪亮的应用程序页面 https://shiny.rstudio.com/articles/debugging.html我使用“展示模式”来尝试找出脚本中的潜在问题。但是当我运行“展示模式”代码时(shiny::runApp(display.mode="showcase"))在本地我收到此警告消息:

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

正如 YBS 在评论中解释的那样,这个错误实际上是闪亮的错误,但是我不知道如何调试我的脚本以部署我的应用程序(我已经尝试在每个的末尾添加一个空行)我的 csv 文件,但没有帮助)

有人已经面临这个问题了吗?

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

注意:如果我使用的话,我的应用程序在本地就像一个魅力shinyApp(ui, server)

以下是有关我的会议的一些信息:

# 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’ 

我想问题不是来自 Shiny,而是来自本地测试机和您尝试部署应用程序的 Shiny 服务器之间的不同区域设置。

您分享的脚本显示您使用了六次read.csv,你得到的错误看起来像尝试将 .csv 文件读入 R 时出现“最后一行不完整”警告 https://stackoverflow.com/questions/5990654/incomplete-final-line-warning-when-trying-to-read-a-csv-file-into-r

首先,我会尝试使用read.csv2代替read.csv因为它更适合法国环境,请参阅doc https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/read.table :

  • 分隔器;
  • 小数点分隔符,

如果这还不够,您尝试加载的文件之一的最后一行缺少 EOL。

The 解决办法 https://stackoverflow.com/a/50124708/13513328是插入readLines into read.csv2:

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法部署 ShinyApp:readTableHeader 在“raw”上发现不完整的最后一行(使用默认值:en_US) 的相关文章

随机推荐