resample: sample() from x rather than 1:x

Description Usage Arguments Details Examples

View source: R/util.R

Description

Modified version of sample() to sample from x rather than 1:x when x has length 1 and is numeric.

Usage

1

Arguments

x, ...

See sample().

Details

See "sample()'s surprise" and "safer version" section in the example section in the help of sample() to understand why this function is necessary.

Examples

1
2
sample(9)  # length 9
blvibmjp:::resample(9)  # length 1

fmsan51/blvibmjp documentation built on Sept. 2, 2020, 9:04 p.m.