Function to randomize the names of a list to sample, as provided by StructureDocument
. It takes the names of the list, not the list itself, and it provides the indexes needed to resample the original list judging by those names. It doesn't output a resampled list.
Usage
GetLayerSampleIndexes(
section_vector,
command_vector,
sampleSectionOrder = FALSE,
randomizeSection = TRUE
)
Arguments
- command_vector
The names of each element on the list we want to sample, with the original order. The usual use would be
NamesOfListToSample = names(list)
.Being specific, the names that are provided will be matched with the regular expression
"^[[:digit:]]+_.+[[:digit:]]+_"
.- sampleSectionOrder
Should it also move around the sections or not? Look at the details for a more detailed explanation
- randomizeSection
If this is set to false, it will not randomize the list, it will just output
1:length(command_vector)
. It handles properly when the list is of length 0, by outputtinginteger(0)
Details
Following the prescription from StructureDocument
, it keeps the "prior_to" and "post_to" parts fixed. And within each section it keeps the "begin_" and "end_" parts fixed. Then, it resamples everything within each section, and afterwards resamples the order of the sections if sampleSectionOrder
is true
Note how the names of the list are expected to represent the structure described in StructureDocument