datasets
.Samples elements at random from the datasets in datasets
.
sample_from_datasets(
datasets,
weights = NULL,
seed = NULL,
stop_on_empty_dataset = TRUE
)
A dataset that interleaves elements from datasets
at random, according to
weights
if provided, otherwise with uniform probability.
A list ofobjects with compatible structure.
(Optional.) A list of length(datasets)
floating-point values where
weights[[i]]
represents the probability with which an element should be sampled
from datasets[[i]]
, or a dataset object where each element is such a list.
Defaults to a uniform distribution across datasets
.
(Optional.) An integer, representing the random seed that will be used to create the distribution.
If TRUE
, selection stops if it encounters an
empty dataset. If FALSE
, it skips empty datasets. It is recommended to
set it to TRUE
. Otherwise, the selected elements start off as the user
intends, but may change as input datasets become empty. This can be
difficult to detect since the dataset starts off looking correct. Defaults
to TRUE
.