
Retrieve a Household Position Definition
Source:R/all_generics.R, R/methods-ReplicaStructure.R
getPositionForName.RdReturns a household-position definition stored within a
ReplicaStructure object.
Usage
getPositionForName(object, position)
# S4 method for class 'ReplicaStructure'
getPositionForName(object, position)Arguments
- object
A
ReplicaStructureobject.- position
Character string identifying the required household role.
Typical values include:
"adult""child"
Details
Household positions are created using
renew and describe the composition of a
household type.
Typical position identifiers include:
"adult""child"
The returned object contains:
- position_identifier
Internal role identifier.
- position
Household-position value(s) used in the synthetic population.
- amount
Number of agents required for the role.
- backup_position_identifiers
Alternative household-position categories that may be used if suitable agents cannot be found in the primary candidate pool.
Household-position definitions are stored internally and are referenced extensively throughout the household-generation workflow.
This method is used by:
An error is raised if the requested position identifier does not exist.
Examples
if (FALSE) { # \dontrun{
hh <- ReplicaStructure(
"Family"
)
hh <- renew(
hh,
household_position = "Parent",
position_identifier = "adult",
amount = 2,
backup_position_identifiers = character()
)
adult_position <- getPositionForName(
hh,
"adult"
)
adult_position$amount
} # }