.BG
.VE $Header: /usr3/s/current/s/.help/RCS/sample,v 1.2 83/12/30 19:34:00 rab Exp $
.FN sample
.TL
sample: Generate Random Samples or Permutations of Data
.CS
sample(x, size, replace)
.PP
.AG x
numeric or character vector of data (the population) to be
sampled, or a scalar giving the size of the population.
Missing values (NAs) are allowed.
.AG size
sample size.  Default is the same as the population size,
and thus (with `replace=FALSE') will generate a random
permutation.
.AG replace
logical flag, if TRUE, sampling will be done with
replacement.  Default FALSE.
.RT
if `x' is a population vector, the result is a sample from
`x'; otherwise, the result is a set of integers between 1
and `x' giving the indices of the selected observations.
.EX
sample(state.name,10)   # pick 10 states at random
sample(1000000,75)  # pick 75 numbers between 1 and one million
sample(50)    # random permutation of numbers 1:50
.KW basic*
.KW random
.KW distribution
.WR
