Learn R Programming

blsAPI (version 0.1.3)

blsQCEW: Request QCEW Data from the U.S. Bureau Of Labor Statistics Open Data Access

Description

Allows users to request quarterly census of employment and wages (QCEW) data from the U.S. Bureau of Labor Statistics open access. Users provide parameters and the function returns a data frame. This function is based off of the sample code developed by the BLS that is found at http://www.bls.gov/cew/doc/access/data_access_examples.htm.

Usage

blsQCEW(method, year = NA, quarter = NA, area = NA, industry = NA,
  size = NA)

Arguments

method
a string describing which type of data you want requested. Valid options are: Area, Industry and Size. The method is not case sensitive.
year
a string for the year of data you want
quarter
a string indicating the quarter (1, 2, 3 or 4) or "a" for the annual average.
area
a string indicating which area you want the data for. See http://www.bls.gov/cew/doc/titles/area/area_titles.htm for all area codes and titles.
industry
a string for the NAICS code. Some industry codes contain hyphens but the open data access uses underscores instead of hyphens. So 31-33 becomes 31_33. For all industry codes and titles see: http://www.bls.gov/cew/doc/titles/industry/industry_titles.
size
a string for the size code. See http://www.bls.gov/cew/doc/titles/size/size_titles.htm for all establishment size classes and titles. Note: Size data is only available for the first quarter of each year.

Details

This function is a wrapper for multiple data request methods. See code examples for which parameters are required for which methods. Visit http://www.bls.gov/cew/opendata.htm for an overview of the BLS's open data access.

Examples

Run this code
## These examples are taken from the sample code examples found at: 
## http://www.bls.gov/cew/doc/access/data_access_examples.htm

## Area Data Request

## Required parameters are:
##  * year
##  * quarter
##  * area

## Example: Request the first quarter of 2013 for the state of Michigan
MichiganData <- blsQCEW('Area', year='2013', quarter='1', area='26000')
## Industry Data Request

## Required parameters are:
##  * industry
##  * quarter
##  * area

## Example: Request Construction data for the first quarter of 2013
Construction <- blsQCEW('Industry', year='2013', quarter='1', industry='1012')

## Size Data Request
##  * size
##  * year

## Example: Request data for the first quarter of 2013 for establishments with 
## 100 to 249 employees
SizeData <- blsQCEW('Size', year='2013', size='6')

Run the code above in your browser using DataLab