Join parent column titles to ACS data based on parent column ID values
Source:R/join_acs.R
join_acs_parent_column.Rd
join_acs_parent_column()
uses data labelled with parent_column_id values to
join parent column titles to a data frame of ACS data.
Usage
join_acs_parent_column(
data,
column_id_col = "column_id",
column_title_col = "column_title",
parent_id_col = "parent_column_id",
suffix = c("", "_parent"),
na_matches = "never",
relationship = "many-to-one"
)
Arguments
- data
A data frame with the specified column names. Expected to be labelled using
label_acs_metadata()
.- column_id_col, column_title_col, parent_id_col
Column ID, column title, and parent column ID.
- suffix
Suffix passed to
dplyr::left_join()
, Default:c("", "_parent")
- na_matches
Should two
NA
or twoNaN
values match?- relationship
Handling of the expected relationship between the keys of
x
andy
. If the expectations chosen from the list below are invalidated, an error is thrown.NULL
, the default, doesn't expect there to be any relationship betweenx
andy
. However, for equality joins it will check for a many-to-many relationship (which is typically unexpected) and will warn if one occurs, encouraging you to either take a closer look at your inputs or make this relationship explicit by specifying"many-to-many"
.See the Many-to-many relationships section for more details.
"one-to-one"
expects:Each row in
x
matches at most 1 row iny
.Each row in
y
matches at most 1 row inx
.
"one-to-many"
expects:Each row in
y
matches at most 1 row inx
.
"many-to-one"
expects:Each row in
x
matches at most 1 row iny
.
"many-to-many"
doesn't perform any relationship checks, but is provided to allow you to be explicit about this relationship if you know it exists.
relationship
doesn't handle cases where there are zero matches. For that, seeunmatched
.