From 10ae8d7d01885562ffe505ba776325d91dd45341 Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Fri, 10 Oct 2025 09:23:50 +0200 Subject: [PATCH 01/11] implemented renaming function (check function and if/else structure depending on whether a named list is provided or a function) --- R/PipeOpRenameColumns.R | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index b7d175e56..1460775ee 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -60,16 +60,16 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", inherit = PipeOpTaskPreprocSimple, public = list( initialize = function(id = "renamecolumns", param_vals = list()) { + browser() ps = ps( renaming = p_uty( - custom_check = crate(function(x) check_character(x, any.missing = FALSE, names = "strict") %check&&% check_names(x, type = "strict"), - .parent = topenv()), + custom_check = crate(function(x) check_character(x, any.missing = FALSE, names = "strict") %check&&% check_names(x, type = "strict") %check||% check_function(x)), tags = c("train", "predict", "required") ), ignore_missing = p_lgl(tags = c("train", "predict", "required")) ) ps$values = list(renaming = character(0), ignore_missing = FALSE) - super$initialize(id, ps, param_vals = param_vals, can_subset_cols = FALSE) + super$initialize(id, ps, param_vals = param_vals, can_subset_cols = TRUE) # TRUE or FALSE? } ), private = list( @@ -77,15 +77,19 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", if (!length(self$param_set$values$renaming)) { return(task) # early exit } - innames = names(self$param_set$values$renaming) - nontargets = task$col_roles - nontargets$target = NULL - takenames = innames %in% unlist(nontargets) - if (!self$param_set$values$ignore_missing && !all(takenames)) { - # we can't rely on task$rename because it could also change the target name, which we don't want. - stopf("The names %s from `renaming` parameter were not found in the Task.", str_collapse(innames[!takenames])) + if (class(self$param_set$values$renaming) != "function") { + innames = names(self$param_set$values$renaming) + nontargets = task$col_roles + nontargets$target = NULL + takenames = innames %in% unlist(nontargets) + if (!self$param_set$values$ignore_missing && !all(takenames)) { + # we can't rely on task$rename because it could also change the target name, which we don't want. + stopf("The names %s from `renaming` parameter were not found in the Task.", str_collapse(innames[!takenames])) + } + task$rename(old = innames[takenames], new = self$param_set$values$renaming[takenames]) + } else { + task$rename(old = unlist(task$col_roles), new = self$param_set$values$renaming(unlist(task$col_roles))) } - task$rename(old = innames[takenames], new = self$param_set$values$renaming[takenames]) } ) ) From 8285b2a6ad108eb2b12bcf613df841ffc5e242af Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Fri, 10 Oct 2025 09:25:23 +0200 Subject: [PATCH 02/11] added example at the end of the file for monday --- R/PipeOpRenameColumns.R | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 1460775ee..7c5b284b4 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -60,7 +60,6 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", inherit = PipeOpTaskPreprocSimple, public = list( initialize = function(id = "renamecolumns", param_vals = list()) { - browser() ps = ps( renaming = p_uty( custom_check = crate(function(x) check_character(x, any.missing = FALSE, names = "strict") %check&&% check_names(x, type = "strict") %check||% check_function(x)), @@ -95,3 +94,13 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", ) mlr_pipeops$add("renamecolumns", PipeOpRenameColumns) + + +# EXAMPLE FOR FUNCTION + +#' task = tsk("iris") +#' pop = po("renamecolumns", renaming = function(colnames) {sub("a", "xy", colnames)}, affect_columns = selector_name("Petal.Length")) +#' pop$train(list(task)) + + + From ceb373df466d750d9cf1081795655a74b2503ee0 Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Mon, 20 Oct 2025 16:32:26 +0200 Subject: [PATCH 03/11] reworked PipeOpRenameColumns using get_state() --- R/PipeOpRenameColumns.R | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 7c5b284b4..108e8ea1d 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -72,12 +72,15 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", } ), private = list( - .transform = function(task) { - if (!length(self$param_set$values$renaming)) { - return(task) # early exit - } - if (class(self$param_set$values$renaming) != "function") { - innames = names(self$param_set$values$renaming) + .get_state = function(task) { + if (is.function(self$param_set$values$renaming)) { + new_names = self$param_set$values$renaming(task$feature_names) + assert_character(new_names, any.missing = FALSE, len = length(task$feature_names), .var.name = "the value returned by `renaming` function") + names(new_names) = task$feature_names + list(old_names = task$feature_names, new_names = new_names) + } else { + new_names = self$param_set$values$renaming + innames = names(new_names) nontargets = task$col_roles nontargets$target = NULL takenames = innames %in% unlist(nontargets) @@ -85,10 +88,14 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", # we can't rely on task$rename because it could also change the target name, which we don't want. stopf("The names %s from `renaming` parameter were not found in the Task.", str_collapse(innames[!takenames])) } - task$rename(old = innames[takenames], new = self$param_set$values$renaming[takenames]) - } else { - task$rename(old = unlist(task$col_roles), new = self$param_set$values$renaming(unlist(task$col_roles))) + list(old_names = innames[takenames], new_names = new_names[takenames]) + } + }, + .transform = function(task) { + if (!length(self$state$new_names)) { + return(task) # early exit } + task$rename(old = self$state$old_names, new = self$state$new_names) } ) ) @@ -102,5 +109,6 @@ mlr_pipeops$add("renamecolumns", PipeOpRenameColumns) #' pop = po("renamecolumns", renaming = function(colnames) {sub("a", "xy", colnames)}, affect_columns = selector_name("Petal.Length")) #' pop$train(list(task)) +# test dazu schreiben (ein test der das assert triggert u.a.)! From fa0e139778e2c81be10ff1f14449be54e18f6752 Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Tue, 21 Oct 2025 15:51:08 +0200 Subject: [PATCH 04/11] updated documentation for PipeOpRenameColumns --- R/PipeOpRenameColumns.R | 11 ++++++++++- man/mlr_pipeops_renamecolumns.Rd | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 108e8ea1d..26d060be9 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -28,10 +28,13 @@ #' #' @section Parameters: #' The parameters are the parameters inherited from [`PipeOpTaskPreproc`], as well as: -#' * `renaming` :: named `character`\cr +#' * `renaming` :: named `character` | `function`\cr +#' Takes the form of either a named `character` or a `function`. #' 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. +#' `function`. Specifies how the column names should be changed to new column names. To choose columns use the +#' `affect_columns` parameter. No function is initialized. #' * `ignore_missing` :: `logical(1)`\cr #' Ignore if columns named in `renaming` are not found in the input [`Task`][mlr3::Task]. If this is #' `FALSE`, then names found in `renaming` not found in the [`Task`][mlr3::Task] cause an error. @@ -54,8 +57,14 @@ #' library("mlr3") #' #' task = tsk("iris") +#' Using a named list #' pop = po("renamecolumns", param_vals = list(renaming = c("Petal.Length" = "PL"))) #' pop$train(list(task)) +#' +#' Using a function +#' pop = po("renamecolumns", param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) +#' pop$train(list(task)) +#' PipeOpRenameColumns = R6Class("PipeOpRenameColumns", inherit = PipeOpTaskPreprocSimple, public = list( diff --git a/man/mlr_pipeops_renamecolumns.Rd b/man/mlr_pipeops_renamecolumns.Rd index 131433937..2cecf1290 100644 --- a/man/mlr_pipeops_renamecolumns.Rd +++ b/man/mlr_pipeops_renamecolumns.Rd @@ -40,10 +40,13 @@ The \verb{$state} is a named \code{list} with the \verb{$state} elements inherit The parameters are the parameters inherited from \code{\link{PipeOpTaskPreproc}}, as well as: \itemize{ -\item \code{renaming} :: named \code{character}\cr +\item \code{renaming} :: named \code{character} | \code{function}\cr +Takes the form of either a named \code{character} or a \code{function}. Named \code{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. +\code{function}. Specifies how the column names should be changed to new column names. To choose columns use the +\code{affect_columns} parameter. No function is initialized. \item \code{ignore_missing} :: \code{logical(1)}\cr Ignore if columns named in \code{renaming} are not found in the input \code{\link[mlr3:Task]{Task}}. If this is \code{FALSE}, then names found in \code{renaming} not found in the \code{\link[mlr3:Task]{Task}} cause an error. @@ -70,8 +73,14 @@ Only methods inherited from \code{\link{PipeOpTaskPreprocSimple}}/\code{\link{Pi library("mlr3") task = tsk("iris") +Using a named list pop = po("renamecolumns", param_vals = list(renaming = c("Petal.Length" = "PL"))) pop$train(list(task)) + +Using a function +pop = po("renamecolumns", param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) +pop$train(list(task)) + } \seealso{ https://mlr-org.com/pipeops.html From e3c1c151898037362f1c37e2a315732ee7ff37e8 Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Wed, 22 Oct 2025 13:57:52 +0200 Subject: [PATCH 05/11] made examples doc line shorter --- R/PipeOpRenameColumns.R | 5 ++--- man/mlr_pipeops_renamecolumns.Rd | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 26d060be9..322406fbb 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -57,12 +57,11 @@ #' library("mlr3") #' #' task = tsk("iris") -#' Using a named list #' pop = po("renamecolumns", param_vals = list(renaming = c("Petal.Length" = "PL"))) #' pop$train(list(task)) #' -#' Using a function -#' pop = po("renamecolumns", param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) +#' pop = po("renamecolumns", +#' param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) #' pop$train(list(task)) #' PipeOpRenameColumns = R6Class("PipeOpRenameColumns", diff --git a/man/mlr_pipeops_renamecolumns.Rd b/man/mlr_pipeops_renamecolumns.Rd index 2cecf1290..15c94faca 100644 --- a/man/mlr_pipeops_renamecolumns.Rd +++ b/man/mlr_pipeops_renamecolumns.Rd @@ -73,12 +73,11 @@ Only methods inherited from \code{\link{PipeOpTaskPreprocSimple}}/\code{\link{Pi library("mlr3") task = tsk("iris") -Using a named list pop = po("renamecolumns", param_vals = list(renaming = c("Petal.Length" = "PL"))) pop$train(list(task)) -Using a function -pop = po("renamecolumns", param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) +pop = po("renamecolumns", + param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) pop$train(list(task)) } From 4f36cf6d63cfd64c78f3449216af2d1e6bafa27a Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Wed, 22 Oct 2025 14:15:43 +0200 Subject: [PATCH 06/11] wrote tests for PipeOpRenameColumns --- tests/testthat/test_pipeop_renamecolumns.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/testthat/test_pipeop_renamecolumns.R b/tests/testthat/test_pipeop_renamecolumns.R index 2439a1d11..278029ce7 100644 --- a/tests/testthat/test_pipeop_renamecolumns.R +++ b/tests/testthat/test_pipeop_renamecolumns.R @@ -39,3 +39,15 @@ test_that("error handling", { op$param_set$values$ignore_missing = TRUE expect_equal(task$data(), op$train(list(task))[[1]]$data()) }) + +test_that("assert on function works", { + task = mlr_tasks$get("iris") + expect_error(po("renamecolumns", param_vals = list(renaming = 1 + 1))) +}) + +test_that("assert on function works", { + task = mlr_tasks$get("iris") + po = po("renamecolumns", param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) + result = po$train(list(task)) + expect_equal(result[[1]]$feature_names, c("P.Length", "P.Width", "Sepal.Length", "Sepal.Width")) +}) From 78aaa01dfcc8602a9eafef3363b3315c297f233e Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Mon, 27 Oct 2025 08:58:08 +0100 Subject: [PATCH 07/11] removed example under code --- R/PipeOpRenameColumns.R | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 322406fbb..0da0e886f 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -109,14 +109,3 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", ) mlr_pipeops$add("renamecolumns", PipeOpRenameColumns) - - -# EXAMPLE FOR FUNCTION - -#' task = tsk("iris") -#' pop = po("renamecolumns", renaming = function(colnames) {sub("a", "xy", colnames)}, affect_columns = selector_name("Petal.Length")) -#' pop$train(list(task)) - -# test dazu schreiben (ein test der das assert triggert u.a.)! - - From 89de645c64ffd0cc8de79f15ec26ee0d4c26877b Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Wed, 29 Oct 2025 21:44:23 +0100 Subject: [PATCH 08/11] get_values for pv --- R/PipeOpRenameColumns.R | 10 ++++++---- tests/testthat/test_pipeop_renamecolumns.R | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 0da0e886f..399ca04a0 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -64,19 +64,20 @@ #' param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) #' pop$train(list(task)) #' + PipeOpRenameColumns = R6Class("PipeOpRenameColumns", inherit = PipeOpTaskPreprocSimple, public = list( initialize = function(id = "renamecolumns", param_vals = list()) { ps = ps( renaming = p_uty( - custom_check = crate(function(x) check_character(x, any.missing = FALSE, names = "strict") %check&&% check_names(x, type = "strict") %check||% check_function(x)), + custom_check = crate(function(x) (check_character(x, any.missing = FALSE, names = "strict") %check&&% check_names(x, type = "strict")) %check||% check_function(x)), tags = c("train", "predict", "required") ), ignore_missing = p_lgl(tags = c("train", "predict", "required")) ) ps$values = list(renaming = character(0), ignore_missing = FALSE) - super$initialize(id, ps, param_vals = param_vals, can_subset_cols = TRUE) # TRUE or FALSE? + super$initialize(id, ps, param_vals = param_vals, can_subset_cols = TRUE) } ), private = list( @@ -87,12 +88,13 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", names(new_names) = task$feature_names list(old_names = task$feature_names, new_names = new_names) } else { - new_names = self$param_set$values$renaming + pv = self$param_set$get_values(tags = "train") + new_names = pv$renaming innames = names(new_names) nontargets = task$col_roles nontargets$target = NULL takenames = innames %in% unlist(nontargets) - if (!self$param_set$values$ignore_missing && !all(takenames)) { + if (!pv$ignore_missing && !all(takenames)) { # we can't rely on task$rename because it could also change the target name, which we don't want. stopf("The names %s from `renaming` parameter were not found in the Task.", str_collapse(innames[!takenames])) } diff --git a/tests/testthat/test_pipeop_renamecolumns.R b/tests/testthat/test_pipeop_renamecolumns.R index 278029ce7..536f44687 100644 --- a/tests/testthat/test_pipeop_renamecolumns.R +++ b/tests/testthat/test_pipeop_renamecolumns.R @@ -47,7 +47,7 @@ test_that("assert on function works", { test_that("assert on function works", { task = mlr_tasks$get("iris") - po = po("renamecolumns", param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) + po = po("renamecolumns", param_vals = list(renaming = function(colnames) sub("Petal", "P", colnames))) result = po$train(list(task)) expect_equal(result[[1]]$feature_names, c("P.Length", "P.Width", "Sepal.Length", "Sepal.Width")) }) From 6b27c0bdf768cd652e3c589eaf32b2243c561638 Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Sun, 2 Nov 2025 21:01:18 +0100 Subject: [PATCH 09/11] changes in doc --- R/PipeOpRenameColumns.R | 14 +++++++------- man/mlr_pipeops_renamecolumns.Rd | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 399ca04a0..44d22ec23 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -30,11 +30,11 @@ #' The parameters are the parameters inherited from [`PipeOpTaskPreproc`], as well as: #' * `renaming` :: named `character` | `function`\cr #' Takes the form of either a named `character` or a `function`. -#' 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. -#' `function`. Specifies how the column names should be changed to new column names. To choose columns use the -#' `affect_columns` parameter. No function is initialized. +#' For a named `character` vector the names of the vector elements specify the +#' old column names and the corresponding element values give the new column names. +#' Initialized to an empty character vector. +#' A `function` specifies how the old column names should be changed to the new column names. +#' To choose columns use the `affect_columns` parameter. No function is initialized. #' * `ignore_missing` :: `logical(1)`\cr #' Ignore if columns named in `renaming` are not found in the input [`Task`][mlr3::Task]. If this is #' `FALSE`, then names found in `renaming` not found in the [`Task`][mlr3::Task] cause an error. @@ -60,9 +60,9 @@ #' pop = po("renamecolumns", param_vals = list(renaming = c("Petal.Length" = "PL"))) #' pop$train(list(task)) #' -#' pop = po("renamecolumns", +#' pof = po("renamecolumns", #' param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) -#' pop$train(list(task)) +#' pof$train(list(task)) #' PipeOpRenameColumns = R6Class("PipeOpRenameColumns", diff --git a/man/mlr_pipeops_renamecolumns.Rd b/man/mlr_pipeops_renamecolumns.Rd index 15c94faca..880c983e6 100644 --- a/man/mlr_pipeops_renamecolumns.Rd +++ b/man/mlr_pipeops_renamecolumns.Rd @@ -42,11 +42,11 @@ The parameters are the parameters inherited from \code{\link{PipeOpTaskPreproc}} \itemize{ \item \code{renaming} :: named \code{character} | \code{function}\cr Takes the form of either a named \code{character} or a \code{function}. -Named \code{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. -\code{function}. Specifies how the column names should be changed to new column names. To choose columns use the -\code{affect_columns} parameter. No function is initialized. +For a named \code{character} vector the names of the vector elements specify the +old column names and the corresponding element values give the new column names. +Initialized to an empty character vector. +A \code{function} specifies how the old column names should be changed to the new column names. +To choose columns use the \code{affect_columns} parameter. No function is initialized. \item \code{ignore_missing} :: \code{logical(1)}\cr Ignore if columns named in \code{renaming} are not found in the input \code{\link[mlr3:Task]{Task}}. If this is \code{FALSE}, then names found in \code{renaming} not found in the \code{\link[mlr3:Task]{Task}} cause an error. @@ -76,9 +76,9 @@ task = tsk("iris") pop = po("renamecolumns", param_vals = list(renaming = c("Petal.Length" = "PL"))) pop$train(list(task)) -pop = po("renamecolumns", +pof = po("renamecolumns", param_vals = list(renaming = function(colnames) {sub("Petal", "P", colnames)})) -pop$train(list(task)) +pof$train(list(task)) } \seealso{ From 4067a7bb3406115936bd6c8f30d656000ff5eada Mon Sep 17 00:00:00 2001 From: Alexander Winterstetter Date: Wed, 5 Nov 2025 19:40:35 +0100 Subject: [PATCH 10/11] doc changes (last commit before Positron transfer) --- R/PipeOpRenameColumns.R | 2 +- man/mlr_pipeops_renamecolumns.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 44d22ec23..5f4059221 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -41,7 +41,7 @@ #' Initialized to `FALSE`. #' #' @section Internals: -#' Uses the `$rename()` mutator of the [`Task`][mlr3::Task] to set the new column names. +#' Uses the `$rename()` mutator of the [`Task`][mlr3::Task] to set new column names. #' #' @section Fields: #' Only fields inherited from [`PipeOp`]. diff --git a/man/mlr_pipeops_renamecolumns.Rd b/man/mlr_pipeops_renamecolumns.Rd index 880c983e6..084f7c7e7 100644 --- a/man/mlr_pipeops_renamecolumns.Rd +++ b/man/mlr_pipeops_renamecolumns.Rd @@ -56,7 +56,7 @@ Initialized to \code{FALSE}. \section{Internals}{ -Uses the \verb{$rename()} mutator of the \code{\link[mlr3:Task]{Task}} to set the new column names. +Uses the \verb{$rename()} mutator of the \code{\link[mlr3:Task]{Task}} to set new column names. } \section{Fields}{ From 0f4bb95b243ec1c3b38df38a3032c7c685568335 Mon Sep 17 00:00:00 2001 From: awinterstetter Date: Thu, 6 Nov 2025 14:23:59 +0100 Subject: [PATCH 11/11] small doc change --- R/PipeOpRenameColumns.R | 1 + man/mlr_pipeops_renamecolumns.Rd | 1 + 2 files changed, 2 insertions(+) diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index 5f4059221..a96cf02c1 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -34,6 +34,7 @@ #' old column names and the corresponding element values give the new column names. #' Initialized to an empty character vector. #' A `function` specifies how the old column names should be changed to the new column names. +#' The function must return a `character` vector with one entry per input column name so that each selected column receives a new name. #' To choose columns use the `affect_columns` parameter. No function is initialized. #' * `ignore_missing` :: `logical(1)`\cr #' Ignore if columns named in `renaming` are not found in the input [`Task`][mlr3::Task]. If this is diff --git a/man/mlr_pipeops_renamecolumns.Rd b/man/mlr_pipeops_renamecolumns.Rd index 084f7c7e7..1eebf6f2f 100644 --- a/man/mlr_pipeops_renamecolumns.Rd +++ b/man/mlr_pipeops_renamecolumns.Rd @@ -46,6 +46,7 @@ For a named \code{character} vector the names of the vector elements specify the old column names and the corresponding element values give the new column names. Initialized to an empty character vector. A \code{function} specifies how the old column names should be changed to the new column names. +The function must return a \code{character} vector with one entry per input column name so that each selected column receives a new name. To choose columns use the \code{affect_columns} parameter. No function is initialized. \item \code{ignore_missing} :: \code{logical(1)}\cr Ignore if columns named in \code{renaming} are not found in the input \code{\link[mlr3:Task]{Task}}. If this is