粘贴错误(v,合拢=“ \ n”):结果将超过2 ^ 31-1个字节

时间:2018-11-02 14:28:20

标签: r out-of-memory

我正在尝试使用以下代码连接大字符向量(2.8 Gb):

x <- paste(v, collapse = "\n")

错误消息:

  

粘贴错误(v,折叠=“ \ n”):结果将超过2 ^ 31-1个字节

据我了解,这是由a limit R施加在单个对象上引起的。但是,我也读到R自3.0.0版以来就可以支持长向量,但无法弄清楚怎么做。我尝试增加环境变量R_MAX_VSIZE=32000000000(32 GB),但没有成功。

我正在运行带有64 GB RAM的Microsoft R Open 3.5.1。我完整的sessionInfo():

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

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

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

other attached packages:
 [1] forcats_0.3.0        stringr_1.3.1        dplyr_0.7.6          purrr_0.2.5          readr_1.2.0          tidyr_0.8.1          tibble_1.4.2         ggplot2_3.0.0        tidyverse_1.2.1     
[10] data.table_1.11.9    RevoUtils_11.0.1     RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18     cellranger_1.1.0 pillar_1.3.0     compiler_3.5.1   plyr_1.8.4       bindr_0.1.1      tools_3.5.1      lubridate_1.7.4  jsonlite_1.5     nlme_3.1-137     gtable_0.2.0    
[12] lattice_0.20-35  pkgconfig_2.0.1  rlang_0.2.1      cli_1.0.0        rstudioapi_0.7   yaml_2.2.0       haven_1.1.2      bindrcpp_0.2.2   withr_2.1.2      xml2_1.2.0       httr_1.3.1      
[23] knitr_1.20       hms_0.4.2.9001   grid_3.5.1       tidyselect_0.2.4 glue_1.3.0       R6_2.2.2         readxl_1.1.0     modelr_0.1.2     magrittr_1.5     backports_1.1.2  scales_0.5.0    
[34] rvest_0.3.2      assertthat_0.2.0 colorspace_1.3-2 stringi_1.2.4    lazyeval_0.2.1   munsell_0.5.0    broom_0.5.0      crayon_1.3.4 

相关帖子:herehereherehere

0 个答案:

没有答案