Status

BLS API Wrapper for R

I have created my first R package! It is called blsAPI and is available through GitHub.  It allows people to request series from the BLS’s API.

To use the function you need to specify the series id(s) and optionally the start and end years.  The following are some example of how you could use this package (these examples are taken from http://www.bls.gov/developers/api_signature.htm):

Single Series

response <- blsAPI('LAUCN040010000000005')
json <- fromJSON(response)

Multiple Series

payload <- list('seriesid'=c('LAUCN040010000000005','LAUCN040010000000006'))
response <- blsAPI(payload)
json <- fromJSON(response)

One or More Series, Specifying Years

payload <- list('seriesid'=c('LAUCN040010000000005','LAUCN040010000000006'), 'startyear'='2010', 'endyear'='2012')
response <- blsAPI(payload)
json <- fromJSON(response)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s