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)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.