View source: R/compute_commute_stats.R
| compute_commute_stats | R Documentation |
Derives three key commute flow metrics from an OD tibble: inflow, outflow, net flow, and the self-containment ratio. These metrics are widely used in transportation planning and economic geography to characterize labor market catchment areas and job/housing balance.
Self-containment is defined as the proportion of workers who both live and work within the same geographic unit, relative to all employed residents. A value close to 1 indicates a highly self-contained labor market; values near 0 indicate heavy out-commuting.
Net flow is defined as inbound workers minus outbound workers (including internal flows as both in and out). This is an unsigned flow balance indicator: positive values signal net job importers (more workers arrive than leave); negative values signal net exporters.
Cross-state commuters: When state_part = "main" is used in
grab_lodes(), only workers who live and work in the same state are
included. Workers who cross state lines (e.g., Maryland residents working
in DC) appear only in state_part = "aux" files for the workplace
state. To capture full commute flows for border counties, retrieve both
"main" and "aux" files and bind the rows before calling
compute_commute_stats().
compute_commute_stats(od_df, agg_geo = "tract")
od_df |
A data frame (tibble) of LODES origin-destination data
returned by Note on row structure: LODES OD files are a flow matrix. A call to
|
agg_geo |
The geographic level of the OD data. Must match the level
at which |
A tibble with one row per geography, containing:
{agg_geo}The geographic identifier.
yearYear of the data (if present in od_df).
stateState FIPS abbreviation (if present in od_df).
workers_inTotal workers arriving (working in this geography).
workers_outTotal workers departing (living here, working elsewhere).
workers_internalWorkers whose home and work are both in this geography (internal flows).
net_flowNet worker flow: workers_in - workers_out. Positive values indicate net job importers.
self_containmentShare of resident workers who also work in this geography: workers_internal / workers_out_total, where workers_out_total includes internal flows.
## Not run:
od <- grab_lodes(
state = "md", year = 2019,
lodes_type = "od", job_type = "JT00",
segment = "S000", state_part = "main",
agg_geo = "county"
)
compute_commute_stats(od, agg_geo = "county")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.