a data frame, a numeric, complex or character vector of data
(the population) to be sampled,
or a positive integer giving the size of the population,
which is then taken to be the sequence of integers from one to this integer.
Missing values (
NAs) are allowed.
OPTIONAL ARGUMENTS:
size
the sample size.
The default is the same as the population size,
and thus (with
replace=FALSE) will generate a random permutation.
replace
if
TRUE, sampling will be done with replacement.
prob
vector of probabilities the same length as data
(or of length data, if data is a positive integer),
giving probabilities of selection for each of the elements of data.
If the elements of
prob do not sum to one,
they will be normalized so that they do.
The default is equal probabilities for each element of the population.
seed
be an integer between 0 and 1000.
Sets the value of the
.Random.seed object in the working
directory.
Different seeds make different sets of random samples.
print.object.p
if
TRUE, the result of the test is printed.
VALUE:
Data frame containing a sample from rows of
data.
If
data is an integer, the result is a sampling of the integers between one
and
data.
If
data is a vector, the result is a sample of its elements.
If
replace is
FALSE and
size is larger than the number of elements
in the population, then the last elements of the result will be
NA.
If
prob is specified it is used as the probabilities that the
elements of
data get selected.
The results are returned invisibly.
SIDE EFFECTS:
If
print.object.p is
TRUE the results are printed.