TITLE(sample @@ Random Samples and Permutations)
USAGE(
sample(x, size, replace=FALSE)
)
ALIAS(sample)
DESCRIPTION(
LANG(sample) takes a sample of the specified size from
the elements of LANG(x) using either with or without replacement
sampling according to the value of LANG(replace).
PARA
By default LANG(size) is equal to LANG(length(x))
so that LANG(sample(x)) generates a random permutation
of the elements of LANG(x).
PARA
If LANG(x) has length 1, sampling takes place from
LANG(1:x).
)
EXAMPLES(
x <- 1:12
# a random permutation
sample(x)
# bootstrap sampling
sample(x,replace=TRUE)
BLANK
# 100 Bernoulli trials
sample(c(0,1), 100, replace = TRUE)
)
