Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Expr>$rep_extend() is needed? #1006

Closed
eitsupi opened this issue Apr 1, 2024 · 0 comments · Fixed by #1028
Closed

<Expr>$rep_extend() is needed? #1006

eitsupi opened this issue Apr 1, 2024 · 0 comments · Fixed by #1028
Labels
enhancement New feature or request
Milestone

Comments

@eitsupi
Copy link
Collaborator

eitsupi commented Apr 1, 2024

I was wondering if Series was dispatching extra methods from Expr, so I was comparing it to Python1 and found this.
It does not exist in Rust/Python and it is not clear to me what it is for.

r-polars/R/expr__expr.R

Lines 3028 to 3042 in 421d2c9

#' Extend a Series by repeating values
#'
#' @param expr Expr or something coercible to an Expr.
#' @inheritParams Expr_rep
#' @param upcast If `TRUE` (default), non identical types will be cast to common
#' supertype if there is any. If `FALSE` or no common super type, having
#' different types will throw an error.
#' @return Expr
#' @examples
#' pl$select(pl$lit(c(1, 2, 3))$rep_extend(1:3, n = 5))
Expr_rep_extend = function(expr, n, rechunk = TRUE, upcast = TRUE) {
other = wrap_e(expr)$rep(n, rechunk = FALSE)
new = .pr$Expr$append(self, other, upcast)
if (rechunk) new$rechunk() else new
}

@sorhawell Please comment if you remember what this was added for and why it is needed.
sorhawell/minipolars@f7a2607

If nothing else I will remove this.

Footnotes

  1. Get diff from dir(polars.Series) in Python and ls(polars::.pr$env$RPolarsSeries) in R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant