Please do follow the posting guide and not sent HTML: it gets mangled.
There are two issues here:
1) Paths. Use Sys.which("wget") to see if the command is on your
path.
I suspect it is not, and you need to set the path when running R in
the same way as is done for your shell. Compare the setting of PATH in
your shell with Sys.getenv("PATH") in R, and use Sys.getenv() to set
it
(or do so on the shortcut used to start R: see the rw-FAQ).
3) AFAIR 'dir' is not a system command. See ?system (on Windows) and
note that shell() is required for some commands: this is one.
These are not R issues, and you may need to seek local Windows help.
On 11/10/2014 02:20, Matt Borkowski wrote:> Hello,
> First please keep in mind I am not a programmer and know very little about
R. I am running the 64bit version of R on a Windows 8.1 machine. I am trying to
run a script (which I have successfully run in the past) to download some
weather data from a NOAA ftp site.
> When I attempt to run the following command: system("wget -P
data/raw ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2013/724620-23061-2013.gz")
>
> it returns status 127, which as I understand simply means the command will
not run.
> If I go directly to my command prompt in Windows, navigate to my working
director, and run wget -P data/raw
ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2013/724620-23061-2013.gz
> the command runs and the file downloads without a problem.
> Playing around, it seems I can't invoke any system commands from R.
Even a simple system("dir")
> returns status 127.
> I have moved to a new computer since I last successfully ran this
script...I'm wondering if this might be a permissions issue or other
security setting preventing me from invoking system commands.
> Any ideas?
> -Matt
> [[alternative HTML version deleted]]
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK