sample_fraction {saeSim} | R Documentation |
Sampling functions
Description
These functions are intended to be used with sim_sample
and not
interactively. They are wrappers around sample_frac and
sample_n.
Usage
sample_fraction(size, replace = FALSE, weight = NULL, groupVars = NULL)
sample_number(size, replace = FALSE, weight = NULL, groupVars = NULL)
sample_numbers(size, replace = FALSE, groupVars = NULL)
sample_cluster_number(size, replace = FALSE, weight = NULL, groupVars)
sample_cluster_fraction(size, replace = FALSE, weight = NULL, groupVars)
Arguments
size |
< |
replace |
Sample with or without replacement? |
weight |
< |
groupVars |
character with names of variables to be used for grouping. |
Details
sample_numbers
is a vectorized version of sample_number
.
sample_cluster_number
and sample_cluster_fraction
will sample
clusters (all units in a cluster).
Examples
sim_base_lm() %>% sim_sample(sample_number(5))
sim_base_lm() %>% sim_sample(sample_fraction(0.5))
sim_base_lm() %>% sim_sample(sample_cluster_number(5, groupVars = "idD"))
sim_base_lm() %>% sim_sample(sample_cluster_fraction(0.5, groupVars = "idD"))
[Package saeSim version 0.11.0 Index]