View source: R/filter_dataset.R
| subset_random_samples | R Documentation |
Selects a random subset of samples from the dataset.
subset_random_samples(dataset, nsamples)
dataset |
Dataset to subset. |
nsamples |
Number of samples to select. |
A dataset object with the same structure as the input, containing a random subset of 'nsamples' samples.
set.seed(123)
data <- matrix(
1:12,
nrow = 3,
dimnames = list(c("x1", "x2", "x3"), c("s1", "s2", "s3", "s4"))
)
metadata <- data.frame(
class = factor(c("A", "A", "B", "B")),
row.names = c("s1", "s2", "s3", "s4")
)
dataset <- list(data = data, metadata = metadata)
subset_random_samples(dataset, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.