assemble | R Documentation |
For fusionACS usage only. Provides a safe and efficient way to assemble (merge) fused microdata across surveys to return a single data table with the requested variables. The requested variables can come from any fused (donor) survey and/or the American Community Survey (ACS). The necessary variables are automatically and efficiently read from the appropriate local file and safely merged on household and/or person ID variables, optionally collapsing or expanding records as necessary depending on the respondent
argument. Assumes (and checks for) a local /fusionData
directory with appropriate file structure and conventions.
assemble(
year,
var,
respondent = "household",
M = 1,
df = NULL,
cores = 1,
source = "all",
silent = FALSE
)
year |
Integer. One or more years for which to return results (i.e. the ACS recipient year). |
var |
Character. Name of one or more variables to return. May contain household- and/or person-level variables. See Details. |
respondent |
Character. Should |
M |
Integer. The first |
df |
Data frame. Data frame used to identify a subset of rows to return. Default is to return all rows. |
cores |
Integer. Number of cores used by the |
source |
Character Specifies where to look for |
silent |
Logical. If |
The var
argument can contain a mix of household- and/or person-level variables. When respondent = "household"
, the reference person (i.e. head of household) value is returned for any person-level variables. When respondent = "person"
, the values of any household-level variables are replicated for each person in the household.
A keyed data table containing the following columns, in addition to the variables named in var
:
Implicate number. See fuse
.
Year of the ACS recipient microdata.
ACS household ID using fusionACS convention.
ACS person ID using fusionACS convention, if respondent = "person"
.
ACS microdata primary sample weight.
# NOTE: Requires local /fusionData directory containing the necessary ACS and .fsd files
test <- assemble(year = 2018:2019,
var = c("dollarel", "hincp", "agep", "state"),
respondent = "household",
M = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.