gpt4 book ai didi

r - 保存 anR 项目时的压缩问题

转载 作者:行者123 更新时间:2023-12-01 06:52:55 25 4
gpt4 key购买 nike

我通过将 R 安装目录移出 C 盘解决了这个问题。感谢 Joris 的伟大建议!我觉得R核心团队也应该把这个当成bug,针对windows xp的保护机制做点什么。

亲爱的社区:

在 R 中使用 BIOMOD 包时,我总是遇到以下问题:

xzfile(file, "wb", compression = 9) 中的错误:无法打开连接
另外: 警告信息:
在 xzfile(file, "wb", compression = 9) 中:
无法初始化 lzma 编码器,错误 5


包的作者和“save”的帮助文件里也说了,应该是没有写权限导致的问题。但是,由于我以管理员帐户登录并对所有操作进行了评估,因此我不知道问题出在哪里。有人可以帮我吗?我现在真的需要运行这个包。先谢谢了~

真挚地,
马可

下面是“保存”帮助文件中的图示:

失败的最常见原因是缺少写入权限
当前目录。对于“save.image”和最后保存
一个 session ,这将通过消息显示

    Error in gzfile(file, "wb") : unable to open connection
In addition: Warning message:
In gzfile(file, "wb") :
cannot open compressed file '.RDataTmp',
probable reason 'Permission denied'
The defaults were changed to use compressed saves for 'save' in
2.3.0 and for 'save.image' in 2.4.0. Any recent version of R can
read compressed save files, and a compressed file can be
uncompressed (by 'gzip -d') for use with very old versions of R.*

抱歉遗漏信息:
这是 sessionInfo():
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Chinese_People's Republic of China.936
[2] LC_CTYPE=Chinese_People's Republic of China.936
[3] LC_MONETARY=Chinese_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese_People's Republic of China.936

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

other attached packages:
[1] BIOMOD_1.1-6.8 foreign_0.8-42 gam_1.04
[4] randomForest_4.6-2 mda_0.4-1 class_7.3-3
[7] gbm_1.6-3.1 lattice_0.19-17 MASS_7.3-11
[10] Design_2.3-0 Hmisc_3.8-3 survival_2.36-5
[13] rpart_3.1-48 nnet_7.3-1 ade4_1.4-16
[16] rgdal_0.6-33 dismo_0.5-19 rJava_0.9-0
[19] raster_1.7-47 sp_0.9-78

loaded via a namespace (and not attached):
[1] cluster_1.13.3 grid_2.12.2 tools_2.12.2

现在我发现问题来自 lzma 编码器在执行“保存”时:
>  x<-runif(100)
> save(x, file = "F:/test.gzip", compress='gzip')
> save(x, file = "F:/test.xz", compress='xz')
Error in xzfile(file, "wb", compression = 9) : cannot open the connection
>

最佳答案

在使用 8 个模型运行建模过程后,我在尝试投影到新场景(包含与预测变量对应的列的表)时遇到了类似的问题。

第一个表(大约 250,000 行)运行良好,我能够将结果保存为 .csv 文件。然而,第二个(大约 380,000 行)导致了上述错误消息,并且某些文件没有写入项目文件夹。

从那以后,我将所有表减少到最多 260,000 行,并且不再收到错误消息。在多次运行中这样做有点痛苦,但是一旦我编写了一次脚本,我只需在 MS Word 中使用查找和替换来为每次运行更改它。

关于r - 保存 anR 项目时的压缩问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5149746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com