Created
September 17, 2017 10:26
-
-
Save privefl/6a1ca203624cd5025136e6ee9be6d776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N <- 23e4 | |
n <- 2e4 | |
prb <- ifelse(sample(0:1, size = N, replace = TRUE) == 1, 1.0, 0.05) | |
smpl <- sampling::UPrandomsystematic(n / sum(prb) * prb) | |
table(prb[as.logical(smpl)]) | |
table(prb[sample.int(N, size = n, replace = FALSE, prob = prb)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment