File: checkTaskSubset.R

package info (click to toggle)
r-cran-mlr 2.19.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,264 kB
  • sloc: ansic: 65; sh: 13; makefile: 5
file content (14 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# @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)
  }
}