
Retrieve Eligible Unassigned Agents in Household Positions
Source:R/fn_get.R
getRemainingAgentsInPosition.RdReturns agents occupying one or more specified household positions that have not yet been assigned during household generation.
Arguments
- object
A
ReplicaStructureobject.- position
Character string or character vector identifying eligible household-position values.
Examples include:
"Parent""Child""SingleAdult"
- mask
Optional logical vector identifying agents that are currently eligible for selection.
If omitted, all agents occupying the specified position categories are considered.
Details
This function is a core candidate-selection utility used throughout the household-generation workflow.
Agents are retained only if:
Their household-position value matches one of the requested positions.
They satisfy the supplied eligibility mask.
They do not appear in the
sampled_agentsslot.
The function performs three filtering steps:
Identify agents whose household-position values belong to the specified position categories.
Apply the supplied logical mask.
Remove agents already assigned and recorded in
sampled_agents.
This function is used by:
and provides the candidate pools used by household-matching algorithms.
Examples
if (FALSE) { # \dontrun{
candidates <- getRemainingAgentsInPosition(
hh,
"Parent"
)
head(candidates)
} # }
if (FALSE) { # \dontrun{
candidates <- getRemainingAgentsInPosition(
hh,
c(
"Parent",
"SingleAdult"
)
)
} # }
if (FALSE) { # \dontrun{
candidates <- getRemainingAgentsInPosition(
hh,
"Parent",
mask = age > 30
)
} # }