
Create a Household Record and Assign a Household Identifier
Source:R/fn_make.R
create_household_with_id.RdCreates a new synthetic household and stores it within a
ReplicaStructure object.
Details
Each household is assigned a unique household identifier of the form:
SSH000001
SSH000002
SSH000003The newly-created household stores:
The complete list of household members.
Members associated with the supplied household role.
This function is used internally during household generation by:
pair_partnersmatchAdultsWithChildren
The household is stored in the households slot.
Each household contains:
- all
Character vector containing all household members.
- position_identifier
Members assigned under the role associated with the supplied position definition.
Household identifiers are generated using:
sprintf("SSH
Examples
if (FALSE) { # \dontrun{
STRUCTURE <- ReplicaStructure(
"CoupleOnly"
)
STRUCTURE <- renew(
STRUCTURE,
what = "positions",
household_position = "Parent",
position_identifier = "adult",
amount = 2,
backup_position_identifiers = character()
)
adult_position <- getPositionForName(
STRUCTURE,
"adult"
)
STRUCTURE <- create_household_with_id(
STRUCTURE,
position = adult_position,
id_offset = 1,
agents = c(
"A001",
"A002"
)
)
names(procure(STRUCTURE, "households"))
} # }