Learn R Programming

TreeTools (version 1.12.0)

SampleOne: Quickly sample

Description

SampleOne() is a fast alternative to sample() that avoids some checks.

Usage

SampleOne(x, len = length(x))

Value

SampleOne() returns a length one vector, randomly sampled from x.

Arguments

x

A vector to sample.

len

(Optional) Integer specifying length of x.

Examples

Run this code
SampleOne(9:10)
SampleOne(letters[1:4])

Run the code above in your browser using DataLab