bsample: Clone of 'sample' without weird behaviour for length(x)==1.

Description Usage Arguments

Description

Identical to sample but when x is an integer it just returns x rather than an integer in 1:x (which is what sample does).

Usage

1
bsample(x, size, replace = FALSE, prob = NULL)

Arguments

x

Either a vector of one or more elements from which to choose, or a positive integer. See sample for details.

size

a positive number, the number of items to choose from.

replace

Should sampling be with replacement?

prob

A vector of probability weights for obtaining the elements of the vector being sampled.


DistanceDevelopment/hsltm documentation built on June 21, 2019, 2:22 p.m.