Skip to content

Commit

Permalink
feat: make $otherwise optional in when-then-otherwise expressions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi committed Feb 24, 2024
1 parent 73462dc commit 9a09cb4
Show file tree
Hide file tree
Showing 19 changed files with 541 additions and 221 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ Collate:
'zzz.R'
Config/rextendr/version: 0.3.1
VignetteBuilder: knitr
Config/polars/LibVersion: 0.37.1
Config/polars/LibVersion: 0.37.2
Config/polars/RustToolchainVersion: nightly-2024-02-03
34 changes: 34 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Generated by roxygen2: do not edit by hand

S3method("!",RPolarsChainedThen)
S3method("!",RPolarsExpr)
S3method("!",RPolarsThen)
S3method("!=",RPolarsChainedThen)
S3method("!=",RPolarsDataType)
S3method("!=",RPolarsExpr)
S3method("!=",RPolarsSeries)
S3method("!=",RPolarsThen)
S3method("$",RPolarsChainedThen)
S3method("$",RPolarsChainedWhen)
S3method("$",RPolarsDataFrame)
Expand Down Expand Up @@ -39,28 +43,52 @@ S3method("$",pl_polars_env)
S3method("$",private_polars_env)
S3method("$<-",RPolarsDataFrame)
S3method("$<-",RPolarsRField)
S3method("%%",RPolarsChainedThen)
S3method("%%",RPolarsExpr)
S3method("%%",RPolarsThen)
S3method("%/%",RPolarsChainedThen)
S3method("%/%",RPolarsExpr)
S3method("%/%",RPolarsThen)
S3method("&",RPolarsChainedThen)
S3method("&",RPolarsExpr)
S3method("&",RPolarsThen)
S3method("*",RPolarsChainedThen)
S3method("*",RPolarsExpr)
S3method("*",RPolarsSeries)
S3method("*",RPolarsThen)
S3method("+",RPolarsChainedThen)
S3method("+",RPolarsExpr)
S3method("+",RPolarsSeries)
S3method("+",RPolarsThen)
S3method("-",RPolarsChainedThen)
S3method("-",RPolarsExpr)
S3method("-",RPolarsSeries)
S3method("-",RPolarsThen)
S3method("/",RPolarsChainedThen)
S3method("/",RPolarsExpr)
S3method("/",RPolarsSeries)
S3method("/",RPolarsThen)
S3method("<",RPolarsChainedThen)
S3method("<",RPolarsExpr)
S3method("<",RPolarsSeries)
S3method("<",RPolarsThen)
S3method("<=",RPolarsChainedThen)
S3method("<=",RPolarsExpr)
S3method("<=",RPolarsSeries)
S3method("<=",RPolarsThen)
S3method("==",RPolarsChainedThen)
S3method("==",RPolarsDataType)
S3method("==",RPolarsExpr)
S3method("==",RPolarsSeries)
S3method("==",RPolarsThen)
S3method(">",RPolarsChainedThen)
S3method(">",RPolarsExpr)
S3method(">",RPolarsSeries)
S3method(">",RPolarsThen)
S3method(">=",RPolarsChainedThen)
S3method(">=",RPolarsExpr)
S3method(">=",RPolarsSeries)
S3method(">=",RPolarsThen)
S3method("[",RPolarsDataFrame)
S3method("[",RPolarsLazyFrame)
S3method("[",RPolarsSeries)
Expand All @@ -87,8 +115,12 @@ S3method("[[",RPolarsStringCacheHolder)
S3method("[[",RPolarsThen)
S3method("[[",RPolarsVecDataFrame)
S3method("[[",RPolarsWhen)
S3method("^",RPolarsChainedThen)
S3method("^",RPolarsExpr)
S3method("^",RPolarsThen)
S3method("|",RPolarsChainedThen)
S3method("|",RPolarsExpr)
S3method("|",RPolarsThen)
S3method(.DollarNames,RPolarsChainedThen)
S3method(.DollarNames,RPolarsChainedWhen)
S3method(.DollarNames,RPolarsDataFrame)
Expand Down Expand Up @@ -134,8 +166,10 @@ S3method(as_polars_lf,default)
S3method(as_polars_series,Array)
S3method(as_polars_series,ChunkedArray)
S3method(as_polars_series,POSIXlt)
S3method(as_polars_series,RPolarsChainedThen)
S3method(as_polars_series,RPolarsExpr)
S3method(as_polars_series,RPolarsSeries)
S3method(as_polars_series,RPolarsThen)
S3method(as_polars_series,data.frame)
S3method(as_polars_series,default)
S3method(as_polars_series,nanoarrow_array)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Polars R Package (development version)

### New features

- In the when-then-otherwise expressions, the last `$otherwise()` is now optional,
as in Python Polars. If `$otherwise()` is not specified, rows that don't respect
the condition set in `$when()` will be filled with `null` (#836).

## Polars R Package 0.14.1

### Breaking changes
Expand Down
10 changes: 10 additions & 0 deletions R/as_polars.R
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,16 @@ as_polars_series.RPolarsExpr = function(x, name = NULL, ...) {
}


#' @rdname as_polars_series
#' @export
as_polars_series.RPolarsThen = as_polars_series.RPolarsExpr


#' @rdname as_polars_series
#' @export
as_polars_series.RPolarsChainedThen = as_polars_series.RPolarsExpr


#' @rdname as_polars_series
#' @export
as_polars_series.POSIXlt = function(x, name = NULL, ...) {
Expand Down
Loading

0 comments on commit 9a09cb4

Please sign in to comment.