The Quarterly Census of Employment and Wages (QCEW) is a division of the BLS. Some QCEW time-series data is available via the main BLS API, but the QCEW also houses quarterly data on their own API. The QCEW API returns employment and wage statistics sliced by area, industry type, or industry size. For further documentation on the QCEW API, you can refer to the QCEW website.
###The QCEW API
The QCEW API is structured differently than the main BLS API. For this reason, the blscrapeR package includes a function for extracting these data.
For example, if we wanted to gather the quarterly employment and wage information for the Software Publishing industry in Q1 of 2016, we could run the following code:
library(blscrapeR) <- qcew_api(year=2021, qtr=1, slice="industry", sliceCode=10)dat
We can also get annual averages by passing “A” as an argument to
library(blscrapeR) <- qcew_api(year=2021, qtr="A", slice="industry", sliceCode=10)dat
year argument is passed as a four-digit numeral.
The data in the QCEW API begin on Q1 2012 and are current up to the most
recently completed quarter.
qtr argument is passed as either a one-digit
numeral or the character “A”, which is used for annual
slice argument defines the QCEW data slice we
would like to query. The current options are “industry”, “area”, and
“size.” One of these terms should be passed in quotes.
sliceCode argument should be either a NIACS
code, FIPS code, or size code; depending on what is specified in the
slice argument. For example, if “industry” is selected for
slice argument, the
must be a NIACS code. Likewise, if the
slice argument is
“area,” a FIPS code should be specified. There are three data sets
included in the
blscrapeR package that lists the acceptable
codes and their descriptions;
##Included Data Sets
qcew_api() function accepts various codes in the
sliceCode argument. The
sliceCode that is used
will depend on the slice we wish to see. There are three built-in data
sets to help with our
##Area Description Data (FIPS codes)
<- blscrapeR::area_titles areaCodes head(areaCodes)
##Industry Description Data (NIACS codes)
<- blscrapeR::niacs industryCodes head(industryCodes)
##Industry Size Data (Size codes)
<- blscrapeR::size_titles sizeCodes head(sizeCodes)