Skip to content

Commit

Permalink
version 0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gunnlaugur Thor Briem authored and gaborcsardi committed Aug 26, 2011
1 parent b3e9d4e commit f2de814
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 18 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Expand Up @@ -8,10 +8,10 @@ Description: Fetches data from DataMarket.com, either as timeseries in
zoo form (dmseries) or as long-form data frames (dmlist).
Metadata including dimension structure is fetched with dminfo,
or just the dimensions with dmdims.
Version: 0.6
Version: 0.6.1
URL: http://datamarket.com/api/lib/rdatamarket
Depends: R (>= 2.10.0), zoo
Collate: 'package.r' 'rdatamarket.r' 'util.r'
Packaged: 2011-08-23 18:39:06 UTC; gthb
Packaged: 2011-08-26 12:14:59 UTC; gthb
Repository: CRAN
Date/Publication: 2011-08-23 20:03:16
Date/Publication: 2011-08-26 18:04:35
13 changes: 7 additions & 6 deletions MD5
@@ -1,13 +1,14 @@
ee4d4fbc931e93a5a74d32e87c31efba *DESCRIPTION
06471e891a85263bd5bb67fea38b821e *NAMESPACE
8dac9696b0ff06d22b0f7322e9b07a0c *NEWS
77edd2757164461deab6ee9e04a432bb *R/package.r
1f052a0f4d64bfaedbbf5d5956a6d61a *R/rdatamarket.r
9d162f681b8a18105538b8a88be645f6 *DESCRIPTION
fdc909b9cb965c08bed244a8341e1227 *NAMESPACE
513b480bf8f84a3b53bd7ef98c8794c1 *NEWS
8423009b4e9fbeb6673fb1d390d532e6 *R/package.r
7ae154c58d711b8f70df63f0acfec424 *R/rdatamarket.r
68dd96bcba0cf6be3c6f7e9390ffde53 *R/util.r
85c54c4b791c4c6470cd189a145dfdb4 *README.md
7a34f8f10337e9b52bbb91ae22be7caa *README.md
65d5b27f729985fcea4a270b54229a12 *demo/00Index
877c93d6c69e5f7cdf1fdf72bc84a340 *demo/rdatamarket-usage.r
6bfdf1f00cc895a718478fdd6fb33334 *inst/tests/test-all.r
03a5156f9f5a5fe2103f736ebfbc3d41 *man/dmCurlOptions.Rd
5dd7524ead630b89f1ddf71eb9e1ef46 *man/dmdims.Rd
e0cd42fa1d806daae25e492c2142decb *man/dminfo.Rd
990841d9182cf2c42131915ae4e6d4fe *man/dminit.Rd
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
@@ -1,3 +1,4 @@
export(dmCurlOptions)
export(dmdims)
export(dminfo)
export(dminit)
Expand Down
13 changes: 11 additions & 2 deletions NEWS
@@ -1,4 +1,13 @@
rdatamarket 0.6
---------------
rdatamarket 0.6.1 (2011-08-26)
--------------------------------------------------------------------------------

* Give full control of Curl options, including (importantly) HTTP proxying

* Fix bug: format/print of dminfo object was failing when source_source absent



rdatamarket 0.6 (2011-08-23)
--------------------------------------------------------------------------------

First release.
2 changes: 1 addition & 1 deletion R/package.r
Expand Up @@ -56,4 +56,4 @@ NULL

.rdatamarketEnv <- new.env()
.rdatamarketEnv$curlopts <- curlOptions()
.rdatamarketEnv$curlopts$httpheader <- NULL
.rdatamarketEnv$api.key <- NULL
35 changes: 29 additions & 6 deletions R/rdatamarket.r
Expand Up @@ -28,10 +28,7 @@ short_url_services <- c(
#' dminit(NULL)
dminit <- function(api.key) {
if (!missing(api.key)) {
.rdatamarketEnv$curlopts$httpheader$`X-DataMarket-API-Key` <- api.key
}
if (length(.rdatamarketEnv$curlopts$httpheader) == 0) {
.rdatamarketEnv$curlopts$httpheader <- NULL # else RCurl acts up
.rdatamarketEnv$api.key <- api.key
}
}

Expand Down Expand Up @@ -306,7 +303,7 @@ format.dmdataset <- function(x, ...) {
sprintf("Title: \"%s\"\nProvider: \"%s\"%s\nDimensions:\n %s",
x$title,
x$meta$provider_title,
ifelse(x$meta$source_source != "",
ifelse(!is.null(x$meta$source_source) && x$meta$source_source != "",
sprintf(" (citing \"%s\")", x$meta$source_source),
""),
paste(lapply(x$dimensions, FUN=format), collapse="\n ")
Expand Down Expand Up @@ -349,6 +346,32 @@ print.dmerror <- function(x, ...) {
invisible();
}

#' Set extra RCurl options for full HTTP control.
#'
#' Use this to control the options with which RCurl connections are created, see
#' \href{http://www.omegahat.org/RCurl/installed/RCurl/html/curlOptions.html}{RCurl::curlOptions}.
#' A common use is setting a proxy to work with your company's firewall setup,
#' see example below.
#'
#' @param ... name-value pairs specifying curl options. See full list of options
#' with `names(getCurlOptionsConstants())`, their types with
#' `getCurlOptionTypes()`, and full documentation in
#' \href{http://curl.haxx.se/docs/manpage.html}{the curl manpage}.
#' @param .opts a named list of options, or a previously created `CURLOptions`
#' object. These are merged with the options specified in `...`.
#' @export
#' @examples
#' \dontrun{dmCurlOptions(proxy='http://outproxy.mycompany.com')}
dmCurlOptions <- function(..., .opts=list()) {
.rdatamarketEnv$curlopts <- curlOptions(.opts=.opts, ...)
}

dmCurlHandle <- function() {
getCurlHandle(.opts=.rdatamarketEnv$curlopts)
getCurlHandle(
.opts=.rdatamarketEnv$curlopts,
httpheader=c(
.rdatamarketEnv$curlopts$httpheader,
'X-DataMarket-API-Key'=.rdatamarketEnv$api.key
)
)
}
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -13,6 +13,10 @@ browser (or a short URL to it) into `dmlist` or `dmseries`:
> plot(dmseries("http://data.is/nyFeP9"))
> l <- dmlist("http://data.is/nyFeP9"))

If you need to go through an HTTP proxy, set it up this way:

> dmCurlOptions(proxy="http://outproxy.mycompany.com")

# Reading metadata

Get a dataset object (find the ID in a datamarket URL, or just paste in
Expand Down
29 changes: 29 additions & 0 deletions man/dmCurlOptions.Rd
@@ -0,0 +1,29 @@
\name{dmCurlOptions}
\alias{dmCurlOptions}
\title{Set extra RCurl options for full HTTP control.}
\usage{
dmCurlOptions(..., .opts = list())
}
\arguments{
\item{...}{name-value pairs specifying curl options. See
full list of options with
`names(getCurlOptionsConstants())`, their types with
`getCurlOptionTypes()`, and full documentation in
\href{http://curl.haxx.se/docs/manpage.html}{the curl
manpage}.}

\item{.opts}{a named list of options, or a previously
created `CURLOptions` object. These are merged with the
options specified in `...`.}
}
\description{
Use this to control the options with which RCurl
connections are created, see
\href{http://www.omegahat.org/RCurl/installed/RCurl/html/curlOptions.html}{RCurl::curlOptions}.
A common use is setting a proxy to work with your
company's firewall setup, see example below.
}
\examples{
\dontrun{dmCurlOptions(proxy='http://outproxy.mycompany.com')}
}

0 comments on commit f2de814

Please sign in to comment.