From ff8cdf3ef8b8e282b6eacc08fffe1f3304004744 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:44:22 +0900 Subject: [PATCH] docs: remove broken `$name$map`'s document (#1123) --- NEWS.md | 2 ++ R/expr__name.R | 22 ++++++++++++---------- man/ExprName_map.Rd | 29 ----------------------------- 3 files changed, 14 insertions(+), 39 deletions(-) delete mode 100644 man/ExprName_map.Rd diff --git a/NEWS.md b/NEWS.md index 266e9dde6..14124a226 100644 --- a/NEWS.md +++ b/NEWS.md @@ -30,6 +30,8 @@ - The `check_sorted` argument is removed from `$rolling()` and `$group_by_dynamic()`. Sortedness is now verified in a quick manner, so this argument is no longer needed (pola-rs/polars#16494). + - `$name$map()` stacks on Linux, so this method is deprecated and the document + is removed. Please use other methods including `$rename_with()` instead (#1123). - As warned in v0.16.0, the order of arguments in `pl$Series` is changed (#1071). The first argument is now `name`, and the second argument is `values`. - `$to_struct()` on an Expr is removed. This method is now only available for diff --git a/R/expr__name.R b/R/expr__name.R index 5a5f81bb9..a540492e4 100644 --- a/R/expr__name.R +++ b/R/expr__name.R @@ -49,6 +49,8 @@ ExprName_keep = function() { unwrap("in $name$keep():") } +# TODO: this method is broken after , so not documented +#' @noRd #' Map alias of expression with an R function #' #' Rename the output of an expression by mapping a function over the root name. @@ -57,16 +59,16 @@ ExprName_keep = function() { #' @return Expr #' #' @examples -#' # df = pl$DataFrame(var1 = 1:3, var2 = "a") -#' # -#' # df$select( -#' # pl$col("*")$name$map(\(x) paste0("new_", x)) -#' # ) -#' # -#' # # $alias() is not taken into account by $name$map() -#' # df$select( -#' # pl$col("var1")$alias("foobar")$name$map(\(x) paste0("new_", x)) -#' # ) +#' df = pl$DataFrame(var1 = 1:3, var2 = "a") +#' +#' df$select( +#' pl$col("*")$name$map(\(x) paste0("new_", x)) +#' ) +#' +#' # $alias() is not taken into account by $name$map() +#' df$select( +#' pl$col("var1")$alias("foobar")$name$map(\(x) paste0("new_", x)) +#' ) ExprName_map = function(fun) { if ( !polars_options()$no_messages && diff --git a/man/ExprName_map.Rd b/man/ExprName_map.Rd deleted file mode 100644 index 14b6e0420..000000000 --- a/man/ExprName_map.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/expr__name.R -\name{ExprName_map} -\alias{ExprName_map} -\title{Map alias of expression with an R function} -\usage{ -ExprName_map(fun) -} -\arguments{ -\item{fun}{an R function which takes a string as input and return a string} -} -\value{ -Expr -} -\description{ -Rename the output of an expression by mapping a function over the root name. -} -\examples{ -# df = pl$DataFrame(var1 = 1:3, var2 = "a") -# -# df$select( -# pl$col("*")$name$map(\(x) paste0("new_", x)) -# ) -# -# # $alias() is not taken into account by $name$map() -# df$select( -# pl$col("var1")$alias("foobar")$name$map(\(x) paste0("new_", x)) -# ) -}