简体   繁体   English

在R中运行wget时,为什么系统状态错误为127?

[英]Why do I get a system status error of 127 when I run wget in R?

I am trying to run a script to download some weather data from a NOAA ftp site. 我正在尝试运行脚本以从NOAA ftp站点下载一些天气数据。 When I attempt to run the following command: 当我尝试运行以下命令时:

system("wget ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2016/999999-54856-2016.gz") 

it returns status 127, which as I understand simply means the command will not run. 它返回状态127,据我了解,这仅意味着该命令将不会运行。 This link on the other hand, seems to be working well and downloads the zip folder when I ran it in the browser. 另一方面,当我在浏览器中运行该链接时,该链接似乎运行良好并下载了zip文件夹。 I read online about adding the path 'C:\\Rtools\\bin' from this link: Create zip file: error running command " " had status 127 but that doesn't seem to work either. 我从此链接在线阅读有关添加路径'C:\\ Rtools \\ bin'的信息: 创建zip文件:运行命令“”时出错,状态为127,但这似乎也不起作用。 I'm wondering if this might be a permissions issue or other security setting preventing me from invoking system commands. 我想知道这是否可能是权限问题或其他安全设置,导致我无法调用系统命令。 Any ideas? 有任何想法吗? Thanks! 谢谢!

You're using Windows. 您正在使用Windows。 wget is a Unix/Linux program. wget是Unix / Linux程序。 You can just call download.file to download from within R: 您可以只调用download.file从R中下载:

download.file("ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2016/999999-54856-2016.gz",
              "999999-54856-2016.gz", mode="wb")

The mode="wb" is important for downloading binary files on Windows. mode="wb"对于在Windows上下载二进制文件很重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM