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