1 — U.S. BUREAU OF LABOR STATISTICS • bls.gov

GASP! Workshop

Automating Occupational 

Profiles Using R Markdown

McLeod Brown

U.S. Bureau of Labor Statistics

September 23, 2019
2 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Occupational Requirements 

Survey (ORS)

 The ORS is a survey conducted by the Bureau of 

Labor Statistics' (BLS) National Compensation Survey

(NCS) program.

 Provides job-related information regarding physical demands; 

environmental conditions; education, training, and experience; as well 

as cognitive and mental requirements for jobs in the U.S. economy.

 Annual survey and produces data at the national level

 Newest survey at the BLS, having released its first set of estimates in 

November of 2016

 Full estimate list via Excel is published at www.bls.gov/ors
3 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

ORS Occupational Profiles

 Released in conjunction with the news release 

and dataset

ORS program also produces high-level 

occupational profiles of different occupations 

using ORS data and continues to create and 

update these throughout the year.

 Currently, we have 40 ORS profiles available 

on our website

 Standardized layout
4 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

ORS Profile Example
5 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Current Process and Reason to 

Automate

 Very repetitive

 Staff spends hours reviewing estimates, choosing which are 

さiミterestiミg,ざ aミd creatiミg profiles

 Drains resources from other programs within Office of Compensation 

and Work Conditions (OCWC)

 Creates conflict with other duties related to Employment Cost Index 

(ECI), Employer Costs for Employee Compensation (ECEC), Benefits, 

and other programs especially during production cycles

 With latest release of ORS data, we now have estimates for 

420 occupations

 420 – 40 = 380 occupations just waiting to be written about!
6 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Why R Markdown

 First used Python

 Cleaning data beforehand, parsing column text

Nested for-loops

Output ミot as ミeat aミd coマpact as we’d like
7 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Why R Markdown, cont.

 R Markdown is used to create fully 

reproducible documents

Cross-language meaning you are able to 

incorporate your language of choice into the 

document - R, Python, SQL

Supports static and dynamic outputs with HTML, 

CSS, JavaScript

AWESOME documentation and tutorials
8 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

R Markdown Starter Code

---

title: "ORS Profiles"

author: "U.S. Bureau of Labor Statistics"

date: "19 September, 2019"

output: html_document

runtime: shiny

---
9 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

R Markdown Starter Code, cont.

 YAML header

"Yet Another Markup Language"

Set title, author, date, output, css, figure height 

and weight options

R Markdown cheat sheet

Run document or Knit function depending on 

incorporation of Shiny
10 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Current R Markdown Product

 Our current R Markdown tool is functional and 

creates a profile for each occupation in our 

dataset

 Reactive function allows us to make our tool 

dynamic and... reactive

Pulls estimates according to occupation chosen

Essentially performing a VLOOKUP
11 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Current R Markdown Product, cont.
12 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Current R Markdown Product, cont.
13 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Current R Markdown Product, cont.
14 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Cons of Current R Markdown 

Product

 Dynamic, but not as dynamic as we'd like

Shows same types of estimates for every 

occupation

Not all estimates are created equal aka some are 

missing or just not interesting

 So, how do we fix that?
15 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Improving Our R Markdown 

Product

 We've identified three main ways to improve 

our tool and have ordered them by most timeconsuming to least

1) Machine Learning

2) Grouping by major occupation group

3) The params function

 All viable options, but how feasible is each?
16 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Improvements, cont.

 Short-term options are grouping by two-digit 

SOC or the params function

Major SOCs should be similar enough

Params function offers great flexibility with our 

program

– Paraマeters are declared usiミg さparamsざ field withiミ 

YAML header

– (i.e., results for specific geo location or time period)
17 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Improvements, cont.

 Long-term goal is machine learning

Gathering training data

Perk of the ORS being such a young survey

 Reticulate package

Incorporate Python code we've already written
18 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Pros of Current R Markdown 

Product

 If we rolled this out tomorrow, it would 

already save our staff hours of data review 

and profile creation

Reduces time from scanning data and pulling 

estimates

Creates charts for staff according to types of 

estimates desired

Responsibilities would revolve around copying 

and pasting and fact-checking
19 — U.S. BUREAU OF LABOR STATISTICS TATISTICS • bls.gov bls.gov

Pros, cont.

 The ORS is a very diverse dataset, with many 

different types of estimates so if we want to 

use this product in other programs...

It should be fairly easy to implement

Modeled Wage Estimates (MWE) profiles

Standardized fact sheets

Similar reproducible documents
Contact Information

20 — U.S. BUREAU OF LABOR STATISTICS • bls.gov

Questions? Comments? Advice?

McLeod Brown

Occupational Requirements Survey

www.bls.gov/ors

202-691-5670

brown.mcleod@bls.gov