Generate samples from a dataset
make_samples.Rd
Generate samples of a dataset.
Argumentos
- data
a dataframe
- n_samples
Number of samples.
- p
Numeric between 0 and 1. Percentage of observations to keep in each sample.
- var_to_stratify
If desired, name of variable to straty the sampling. Default NULL.
- pond
A numeric vector of sample weights. Default NULL.
- seed
Numeric.
Ejemplos
ecv <- read_csv('ecv.csv')
#> Error in read_csv("ecv.csv"): no se pudo encontrar la función "read_csv"
# Make 10 samples, 90% of observations in each one and stratify by CCAA
ecv_samples <- make_samples(ecv, 10, .9, 'CCAA')
#> Error in make_samples(ecv, 10, 0.9, "CCAA"): objeto 'ecv' no encontrado
# Taking into account sample weights
ecv_samples <- make_samples(ecv, 10, .9, 'CCAA', ecv$factor_hogar)
#> Error in make_samples(ecv, 10, 0.9, "CCAA", ecv$factor_hogar): objeto 'ecv' no encontrado