R ff package ffsave 'zip' not found

2020-07-10 06:09发布

问题:

Reproduceable Example:

library("ff")
m <- matrix(1:12, 3, 4, dimnames=list(c("r1","r2","r3"), c("m1","m2","m3","m4")))
v <- 1:3    
ffm <- as.ff(m)    
ffv <- as.ff(v)        
d <- data.frame(m, v)

ffd <- ffdf(ffm, v=ffv, row.names=row.names(ffm))

 ffsave(ffd,file="C:\\Users\\R.wd\\ff\\ffd")
 ## Error in system(cmd, input = filelist, intern = TRUE) : 'zip' not found

System: Windows 7 64bit, R 15.2 64bit

Rtools installed

zip 300xn-x64 and unzip 600xn folders set to windows Path already

cmd line working, type zip or unzip it shows function info

Need help! Any suggestion is appreciated.

回答1:

It seems your path is not set for Zip, set path in environment variables. If you don't want to set path for all process you can do it for single command line session by SET command but then you have to start your R within same session.



回答2:

Some of the links and downloads given in the documentation appears to be outdated. Here are the steps that are known to work on Windows 7, 64 bit: For ffsave and ffload to work correctly:

# Download zip 3.x and unzip 5.x. The correct URLs are:
# http://gnuwin32.sourceforge.net/packages/zip.htm
# http://gnuwin32.sourceforge.net/packages/unzip.htm
# Install both (they default to the same GnuWin32 directory). 
# Put the installation's \bin folder on the system PATH
# Restart R studio.


回答3:

The 'zip' not found issue is a problem not unique to the ff package. Here is a simple solution.

  1. Download Rtools https://cran.r-project.org/bin/windows/Rtools/
  2. Open Rtools and navigate to the bin folder. Rtools > bin
  3. In a separate window, open your r path. For example, mine is C:\Program Files\R\R-2.15.2\bin\x64 (more details at CRAN R for windows FAQ)
  4. Copy the the Rtools Application "zip" (from 2) into the r path folder (from 3)

Now you should be able to save your file. If you want to load your file you'll need to copy unzip into your r path folder as well.



标签: r bigdata ffbase