I solved the problem by moving the R installation directory from drive C. Thanks to Joris for great suggestions! I think the main R group should also accept this as an error and do something against the windows xp defense mechanism.
Expensive community:
When using BIOMOD packages in R, the following problem always occurs:
Error in xzfile file (file, "wb", compression = 9): Cannot open the connection. Also: Warning message: In xzfile (file, "wb", compression = 9): cannot initialize lzma encoder, error 5
This was stated by the author of the package, as well as in the "save" help file, that the problem should be caused by a lack of write permission. However, since I register as an administrative account and evaluate all operations, I have no idea what the problem is. Can anybody help me? I really need to run the package now. Thanks in advance ~
Regards, Marco
The following is an illustration in the help file "save":
The most common cause of failure is the lack of write permissions to the current directory. For "save.image" and for saving at the end of the session that will be displayed with messages, for example
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.*
Sorry for the info: Here is sessionInfo ():
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Chinese_People Republic of China.936
[2] LC_CTYPE=Chinese_People Republic of China.936
[3] LC_MONETARY=Chinese_People Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese_People 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
Now I find that the problem arises from the lzma encoder when executing "save":
> 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
>