Revision b57049d9ae4b73b8de7d012d648e7cca9a6478bc authored by pat-s on 22 January 2020, 12:41:32 UTC, committed by pat-s on 22 January 2020, 12:41:32 UTC
1 parent 141ae03
Raw File
checkTaskSubset.R
# @template arg_subset
# @param size [int(1)]\cr size of the dataset to subset
# @return numeric vector of subset indices
checkTaskSubset = function(subset = NULL, size) {
  assertCount(size)
  if (is.null(subset)) {
    seq_len(size)
  } else if (is.logical(subset)) {
    subset = which(subset)
    assertInteger(subset, min.len = 1L, upper = size)
  } else {
    asInteger(subset, min.len = 1L, any.missing = FALSE, lower = 1L, upper = size)
  }
}
back to top