samp_with: Sample with custom function

Description Usage Arguments Examples

View source: R/svysim.R

Description

Sample with custom function

Usage

1
samp_with(population, sampling_f, n, ...)

Arguments

population

A dataframe, which will be wrapped internally around DeclareDesign::declare_design. See help page here.

sampling_f

A sampling function that can be passed as a handler to declare_sampling.

n

the sample size to draw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Population Value
stat_dem(pop_cces)

# SRS
samp0  <- samp_with(pop_cces, samp_srs, n = 1000)
stat_dem(samp0)

# Oversample Higher-ed
samp1  <- samp_with(pop_cces, samp_highed, n = 1000)
stat_dem(samp1)

kuriwaki/svysim documentation built on Jan. 27, 2021, 5:37 a.m.