download.file(url, destfile, method="internal", quiet=TRUE, mode="w", ..., verbose=!quiet, download.args=list(...))
"internal"
is supported.
TRUE
, status messages are not printed.
name=value
.
These will get combined in the
download.args
list.
See the details section for the types of additional arguments
that can be supplied.
The additional arguments should either be supplied in the
name=value
form or in the
download.args
list but not both.
TRUE
, status messages are printed.
name=value
form.
If a value for
download.args
is supplied then
the additional arguments supplied in
name=value
form
will be ignored.
See the details section for the types of additional arguments
that can be supplied.
destfile
is created.
The function
download.file
uses the CURL library,
see the reference.
Possible values to supply in the
...
or on the
download.args
list:
postfields = "string"
- The full data to post in an
HTTP POST operation.
You must make sure that the data is formatted the
way you want the server to receive it.
The data will not be converted or encoded by the function.
Most web servers will assume this data to be url-encoded.
userpwd = "username:password"
- A user name and
password to use for the connection.
proxy = "hostname"
or
proxy = "http://hostname"
or
proxy = "http://hostname:port"
-
Set HTTP proxy to use.
proxyuserpwd = "username:password"
- the user name and
password to use for the connection to the HTTP proxy.
If http connections must go through a proxy server you can use the environment variable "http_proxy" to set the URL of the proxy and the username:password combination possibly required by the proxy. The format is "http://hostname" (or "http://hostname:port") if no username or password is required and "http://username:password@hostname" (or "http://username:password@hostname:port"), where "hostname" is the name of the proxy and "port" is its port number (default 80) on that host.
You can set the environment variable http_proxy before starting Splus.
It will affect other programs using the CURL library and some
other intenet connectivity libraries.
This is the recommended way to pass proxy information to download.file
when using functions that call it, such as
download.packages
.
(On Unix-like platforms you can use
Sys.setenv
to set it before your first call to
download.file
.)
The cURL web site: http://curl.haxx.se/.
# Get a copy of Google's home page, store in a tempfile gtmpfile <- tempfile("google") download.file("http://www.google.com", gtmpfile) # Remove tempfile when finished: unlink(gtmpfile) # Get weather data from Smith Island, at east end of Strait of # Juan de Fuca (Washington, USA). Read the data into S-PLUS # and plot: wtmpfile <- tempfile("weather") download.file("http://www.ndbc.noaa.gov/data/realtime2/SISW1.txt", wtmpfile) weatherDF <- read.table(wtmpfile, header=T) plot(weatherDF$BARO, type="l") # Remove tempfile when finished: unlink(wtmpfile)