Renames the columns of a Task both during training and prediction. Uses the $rename() mutator of the Task.

Format

R6Class object inheriting from PipeOpTaskPreprocSimple/PipeOp.

Construction

PipeOpRenameColumns$new(id = "renamecolumns", param_vals = list())
  • id :: character(1)
    Identifier of resulting object, default "renamecolumns".

  • param_vals :: named list
    List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default list().

Input and Output Channels

Input and output channels are inherited from PipeOpTaskPreprocSimple.

The output is the input Task with the old column names changed to the new ones.

State

The $state is a named list with the $state elements inherited from PipeOpTaskPreprocSimple.

Parameters

The parameters are the parameters inherited from PipeOpTaskPreprocSimple, as well as:

  • renaming :: named character
    Named character vector. The names of the vector specify the old column names that should be changed to the new column names as given by the elements of the vector. Initialized to the empty character vector.

  • ignore_missing :: logical(1)
    Ignore if columns named in renaming are not found in the input Task. If this is FALSE, then names found in renaming not found in the Task cause an error. Initialized to FALSE.

Internals

Uses the $rename() mutator of the Task to set the new column names.

Fields

Only fields inherited from PipeOpTaskPreprocSimple/PipeOp.

Methods

Only methods inherited from PipeOpTaskPreprocSimple/PipeOpTaskPreproc/PipeOp.

See also

Examples

library("mlr3") task = tsk("iris") pop = po("renamecolumns", param_vals = list(renaming = c("Petal.Length" = "PL"))) pop$train(list(task))
#> $output #> <TaskClassif:iris> (150 x 5) #> * Target: Species #> * Properties: multiclass #> * Features (4): #> - dbl (4): PL, Petal.Width, Sepal.Length, Sepal.Width #>