sample_households: Sample appropriate indices from household PUMS

Description Usage Arguments Value Examples

View source: R/sample-people.R

Description

Sample appropriate indices from household PUMS

Usage

1
2
sample_households(method, n_house, pums_h, pums_p = NULL, puma_id = NULL,
  place_id = NULL, marginals = NULL)

Arguments

method

character indicating the method for sampling

n_house

numeric indicating the number of households to sample

pums_h

dataframe of the households we are sampling from

pums_p

optionally include a dataframe of agents

puma_id

vector indicating which specific puma in PUMS we are sampling from, if any

place_id

unique code identifying the place

marginals

optionally used for IPF or MM sampling

Value

numeric with the indicies of the household PUMS to sample

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data("tartanville")
example_place_id <- tartanville$pop_table$place_id[1] 
example_puma_id <- tartanville$pop_table$puma_id[1] 
example_n_house <- tartanville$pop_table$n_house[1] 
sample_households(method = "uniform", 
                  pums_h = tartanville$pums_h, 
                  pums_p = tartanville$pums_p, 
                  n_house = example_n_house, 
                  place_id = example_place_id, 
                  puma_id = example_puma_id)

leerichardson/spew documentation built on May 21, 2019, 1:39 a.m.