Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

r - Create zip file: error running command " " had status 127

I am trying to create a zip file from multiple files using the zip function in r, but I keep getting this error message: running command '"zip" -r9X "data.zip" "dt1.txt" "dt2.txt" ' had status 127.

How can I avoid that?

setwd()
dt1 <- sample(1:100, 10)
dt2 <- sample(100:200, 10)
write(dt1, "dt1.txt")
write(dt2, "dt2.txt")

zip('data.zip', files =c('dt1.txt', 
                         'dt2.txt'))
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here is how I solved this problem on my Windows 7 computer:

  1. Install Rtools from HERE.
  2. Locate the folder that Rtools is installed. In my case it is at C:Rtools.
  3. Add C:Rtoolsin path to the system path.

Adding C:Rtoolsin to the system path:

  1. Go to Control Panel >> System and Security >> System
  2. Go to Advanced System Settings
  3. Open Advanced tab
  4. Click Environmental Variables... button
  5. Select Path variable and click Edit button
  6. If there is nothing as a "Variable Value" you can simply write C:Rtoolsin. If there is already a value, then add ;C:Rtoolsin to the end of it.
  7. Click OK, OK...
  8. Restart R, it should work.

I hope this helps. I found the solution HERE.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...