File: hasFunctionalFeatures.R

package info (click to toggle)
r-cran-mlr 2.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,760 kB
  • sloc: ansic: 65; sh: 13; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 560 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#' @title Check whether the object conatins functional features.
#'
#' @description
#' See title.
#'
#' @param obj (`Task` | `TaskDesc` | `data.frame`)\cr
#'   Object to check.
#' @return (`logical(1)`)
#' @export
hasFunctionalFeatures = function(obj) {
  UseMethod("hasFunctionalFeatures")
}

hasFunctionalFeatures.data.frame = function(obj) {
  any(vlapply(obj, is.matrix))
}

hasFunctionalFeatures.Task = function(obj) {
  hasFunctionalFeatures.TaskDesc(obj$task.desc)
}

hasFunctionalFeatures.TaskDesc = function(obj) {
  obj$n.feat["functionals"] > 0L
}