Generates a Sample from a set, with replacement
r_sample(sample, weights = NULL, ..., n = default_n(), .seed = NULL)
sample | a set of values to choose from |
---|---|
weights | a vector of weights, must be the same length as |
... | Unused |
n | number of observations to generate. The |
.seed | One of the following:
To extract the random seed from a previously generated set of
values, use |
A vector of length n
of the same type as sample
#> [1] "red" "blue" "yellow" "red" "red" "yellow" "blue" "blue" #> [9] "red" "red" "red" "red" "red" "red" "red"#> [1] "blue" "red" "red" "red" "red" "red" "red" "red" #> [9] "yellow" "red" "blue" "blue" "red" "blue" "red"#> [1] "blue" "red" "blue" "blue" "blue" "yellow" "blue" "blue" #> [9] "yellow" "blue"