Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

resample

Sample values from a set of elements


Description

Sample values from a set of elements. Contrary to sample(), this function also works as expected when there is only one element in the set to be sampled, cf. [1]. This function originates from the example code of sample() as of R v2.12.0.

Usage

## Default S3 method:
resample(x, ...)

Arguments

x

A vector of any length and data type.

...

Additional arguments passed to sample.int().

Value

Returns a sampled vector of the same data types as argument x.

Author(s)

Henrik Bengtsson

References

[1] Henrik Bengtsson, Using sample() to sample one value from a single value?, R-devel mailing list, 2010-11-03.

See Also

Internally sample.int() is used.


R.utils

Various Programming Utilities

v2.10.1
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.