S <- complete_rs(N = 100)
table(S)
S <- complete_rs(N = 100, n = 50)
table(S)
S <- complete_rs(N = 100, n_unit = rep(30, 100))
table(S)
S <- complete_rs(N = 100, prob = 0.111)
table(S)
S <- complete_rs(N = 100, prob_unit = rep(0.1, 100))
table(S)
# If N = n, every unit is sampled with probability 1
complete_rs(N = 2, n = 2)
# The single-unit case works the same way: n = 1 out of N = 1 is sampled
# with probability 1. Up through randomizr 0.12.0 this case was instead
# treated as a coin flip, so the unit was sampled only half of the time.
# The change is noted here because it silently alters the inclusion
# probabilities in code written against those versions.
complete_rs(N = 1, n = 1)
Run the code above in your browser using DataLab