Skip to contents

Creates a new synthetic household and stores it within a ReplicaStructure object.

Usage

create_household_with_id(object, position, id_offset, agents)

Arguments

object

A ReplicaStructure object.

position

Household-position definition returned by getPositionForName.

id_offset

Integer offset used to generate a unique household identifier.

agents

Character vector containing the agent IDs that belong to the household.

Value

An updated ReplicaStructure object containing the newly-created household.

Details

Each household is assigned a unique household identifier of the form:


SSH000001
SSH000002
SSH000003

The 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:

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{

hh <- ReplicaStructure(
  "CoupleOnly"
)

hh <- renew(
  hh,
  household_position = "Parent",
  position_identifier = "adult",
  amount = 2,
  backup_position_identifiers = character()
)

adult_position <- getPositionForName(
  hh,
  "adult"
)

hh <- create_household_with_id(
  hh,
  position = adult_position,
  id_offset = 1,
  agents = c(
    "A001",
    "A002"
  )
)

names(hh@households)

} # }