powered by
Boilerplate function to sample one element from a vector.
txt_sample(x, na.exclude = TRUE, n = 1)
one element sampled from the vector x
a vector
logical indicating to remove NA values before taking a sample
integer indicating the number of items to sample from x
x
sample.int
txt_sample(c(NA, "hello", "world", NA))
Run the code above in your browser using DataLab