Learn R Programming

udpipe (version 0.8.11)

txt_sample: 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)

Value

one element sampled from the vector x

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

See Also

Examples

Run this code
txt_sample(c(NA, "hello", "world", NA))

Run the code above in your browser using DataLab