| safe_sample | R Documentation |
R's sample() has quirky behavior: sample(5, 1) samples from 1:5, not from c(5). This function ensures we sample from the actual vector provided.
safe_sample(x, size, replace = FALSE)
x |
Vector to sample from |
size |
Number of samples |
replace |
Sample with replacement? |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.