txt_sample: Boilerplate function to sample one element from a vector.

View source: R/utils.R

txt_sampleR Documentation

Boilerplate function to sample one element from a vector.

Description

Boilerplate function to sample one element from a vector.

Usage

txt_sample(x, na.exclude = TRUE, n = 1)

Arguments

x

a vector

na.exclude

logical indicating to remove NA values before taking a sample

n

integer indicating the number of items to sample from x

Value

one element sampled from the vector x

See Also

sample.int

Examples

txt_sample(c(NA, "hello", "world", NA))

udpipe documentation built on Jan. 6, 2023, 5:06 p.m.