subsetTask(task, subset = NULL, features)
(integer | logical |
Selected cases. Either a logical or an index vector.
NULL if all observations are used.
(character | integer | logical)
Vector of selected inputs. You can either pass a character vector with the
feature names, a vector of indices, or a logical vector.
In case of an index vector each element denotes the position of the feature
name returned by getTaskFeatureNames.
Note that the target feature is always included in the
resulting task, you should not pass it here.
Default is to use all features.
(Task). Task with subsetted data.
task = makeClassifTask
(data = iris
, target = "Species"
, subset = 1
#> Supervised task: iris
#> Type: classif
#> Target: Species
#> Observations: 100
#> numerics factors ordered functionals
#> 4 0 0 0
#> Missings: FALSE
#> Has weights: FALSE
#> Has blocking: FALSE
#> Has coordinates: FALSE
#> Classes: 3
#> setosa versicolor virginica
#> 50 50 0
#> Positive class: NA