Learn R Programming

ff (version 1.0-1)

sample: Random Samples and Permutations

Description

sample takes a sample of the specified size from the elements of x using either with or without replacement.

Usage

sample(x, size, replace = FALSE, prob = NULL)

Arguments

x
Either a (numeric, complex, character or logical) vector of more than one element from which to choose, or a positive integer.
size
non-negative integer giving the number of items to choose.
replace
Should sampling be with replacement?
prob
A vector of probability weights for obtaining the elements of the vector being sampled.

Details

See the corresponding help file of sample for further details and examples.