rdatamarket (version 0.6.5)

dmlist: Fetch data in long form as a data.frame from a DataMarket dataset.

Description

This performs a list API request at DataMarket.com, fetching the requested data and wrapping it in a data.frame object.

Usage

dmlist(ds, .params = list(), ...)

Arguments

ds
a dataset ID, DS string, URL query-string, or whole URL. The DS string to send is extracted from the URL as needed, and short URLs at data.is, bit.ly, is.gd, t.co and url.is are expanded.
.params
extra GET parameters to pass along in the API request.
...
named parameters whose names are dimension titles or IDs, and whose values are titles or IDs of values of those dimensions. E.g. if dataset 17tm has a dimension named Country, then dmlist("17tm", Country="Algeria") filters on that dimension. If the dimension name includes spaces, it needs to be quoted: dmlist("12rb", "Country or Area"="Afghanistan")

Value

a data frame representing the fetched data. The data frame has one column for each of the dataset's dimensions, containing a factor whose levels are values of that dimension, and a `Value` column holding a numerical value for each combination of dimension values.

Examples

Run this code
dmlist("17tm")
dmlist("17tm!kqc=a")
dmlist("ds=17tm")
dmlist("ds=17tm!kqc=a")
dmlist("foo=bar&ds=17tm&baz=xyzzy")
dmlist("http://datamarket.com/api/v1/series.json?foo=bar&ds=17tm&baz=xyzzy")
dmlist("http://datamarket.com/data/set/17tm/#ds=17tm")
dmlist("17tm", Country="Algeria")
dmlist("17tm", Country=c("Algeria", "Angola"))
dmlist("12rb", "Country or Area"="Afghanistan")

Run the code above in your browser using DataLab