| grab_lodes | R Documentation |
Download LODES OD, RAC, and WAC tables from the LEHD FTP server and return a tidy data frame.
grab_lodes(
state,
year,
version = c("LODES8", "LODES7", "LODES5"),
lodes_type = c("od", "rac", "wac"),
job_type = c("JT00", "JT01", "JT02", "JT03", "JT04", "JT05"),
segment = c("S000", "SA01", "SA02", "SA03", "SE01", "SE02", "SE03", "SI01", "SI02",
"SI03"),
agg_geo = c("block", "bg", "tract", "county", "state"),
state_part = c("", "main", "aux"),
download_dir = normalizePath(file.path(tools::R_user_dir("lehdr", which = "cache")),
mustWork = FALSE),
geometry = FALSE,
use_cache = getOption("lehdr_use_cache", FALSE),
...
)
state |
US state abbreviation in lower case, as character.
Can be a vector of states, like |
year |
Year of the LODES data, as a numeric integer.
Can be a vector of years, like |
version |
The LODES version to use. |
lodes_type |
The LODES table type. Values can be the default
origin-destination ( |
job_type |
Job type segment: |
segment |
Workforce segment. |
agg_geo |
Aggregate to a geography other than Census Block (default).
Values can be |
state_part |
Part of the state file; required when
|
download_dir |
Directory where the LODES file will be downloaded.
Defaults to the user-level cache directory for |
geometry |
If |
use_cache |
Boolean. If |
... |
Additional arguments passed to |
A tibble of LODES data aggregated to block, block group, tract,
county, or state level. If geometry = TRUE and lodes_type is
"rac" or "wac", returns an sf object.
## Not run:
# Download 2014 block-level OD data for Vermont
blk_od <- grab_lodes(
state = "vt", year = 2014,
lodes_type = "od", job_type = "JT01",
segment = "SA01", state_part = "main"
)
# Download 2014 OD data for Vermont aggregated to tract level
trt_od <- grab_lodes(
state = "vt", year = 2014,
lodes_type = "od", job_type = "JT01",
segment = "SA01", state_part = "main",
agg_geo = "tract"
)
# Download 2020 RAC data for Vermont aggregated to tract level
trt_rac <- grab_lodes(
state = "vt", year = 2020,
lodes_type = "rac", job_type = "JT01",
segment = "SA01", agg_geo = "tract"
)
# Download 2020 WAC data for Vermont aggregated to tract level
trt_wac <- grab_lodes(
state = "vt", year = 2020,
lodes_type = "wac", job_type = "JT01",
segment = "SA01", agg_geo = "tract"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.