Compute earnings tier shares from LODES RAC or WAC data
Source:R/compute_earnings_share.R
compute_earnings_share.RdComputes the share of jobs (or workers) in each of the three LODES monthly earnings tiers:
- Low (
CE01) Earnings up to $1,250/month.
- Mid (
CE02) Earnings $1,251-$3,333/month.
- High (
CE03) Earnings above $3,333/month.
Earnings shares are useful for tracking wage polarization, identifying
low-wage job concentration, and examining how the earnings structure of
a labor market has shifted over time, especially when combined with
compute_lodes_change().
The total denominator is the sum of the three tiers, ensuring shares sum to 1 within rounding error.
Arguments
- lodes_df
A data frame (tibble) of LODES RAC or WAC data returned by
grab_lodes()withsegment = "S000"(the total count segment, which includes all three earnings columns). Must contain columnsCE01,CE02, andCE03. Both WAC and RAC files include these earnings tier columns; thetypeargument controls only which geography prefix is used for auto-detection.- type
One of
"wac"(workplace area characteristics, default) or"rac"(residential area characteristics). Controls the expected geography column prefix (w_for WAC,h_for RAC) whengeo_col = NULL. Does not affect which earnings columns are used, as both file types share theCE01/CE02/CE03schema.- geo_col
The name of the geography column to group by, e.g.
"w_tract"or"h_county". Defaults toNULL, which auto-detects the first geography column inlodes_df.- output
One of
"wide"(default) or"long". Wide format appends three share columns. Long format returns one row per geography-tier combination.
Value
A tibble with earnings tier counts and shares. In "wide" format,
columns are added for share_low, share_mid, and share_high. In
"long" format, columns are tier, label, count, and share.
Examples
if (FALSE) { # \dontrun{
wac <- grab_lodes(
state = "md", year = 2019,
lodes_type = "wac", job_type = "JT00",
segment = "S000", agg_geo = "county"
)
compute_earnings_share(wac, type = "wac", geo_col = "w_county")
# Long format, suitable for ggplot2
compute_earnings_share(
wac, type = "wac", geo_col = "w_county", output = "long"
)
} # }