
Convert Synthetic Households to a Data Frame
Source:R/all_generics.R, R/methods-ReplicaStructure.R
householdsToDataFrame.RdCreates a household-level summary table from the household
records stored within a ReplicaStructure object.
Usage
householdsToDataFrame(object)
# S4 method for class 'ReplicaStructure'
householdsToDataFrame(object)Arguments
- object
A
ReplicaStructureobject.
Value
A data frame containing one row per household.
The returned table contains:
- household_id
Unique household identifier.
- neighb_code
Neighbourhood identifier associated with the household.
- hh_type
Household type.
- hh_size
Number of agents assigned to the household.
Details
Each row in the returned data frame represents a single synthetic household and contains summary information such as household identifier, household type and household size.
This method is typically called after household generation and household assignment have been completed.
Household size is calculated as:
length(household$all)where household$all contains the identifiers of all
household members.
The neighbourhood code is obtained from the first household member and is assumed to be common to all members of the household.
If no households have been generated, an empty data frame with the expected columns is returned.
This method is typically used after:
Household generation.
Household validation.
Examples
if (FALSE) { # \dontrun{
households <- householdsToDataFrame(
hh
)
head(households)
} # }