Skip to content

Compare Series

Source code

Description

Check the (in)equality of two Series.

Usage

<Series>$compare(other, op)

# S3 method for class 'RPolarsSeries'
s1 == s2

# S3 method for class 'RPolarsSeries'
s1 != s2

# S3 method for class 'RPolarsSeries'
s1 < s2

# S3 method for class 'RPolarsSeries'
s1 > s2

# S3 method for class 'RPolarsSeries'
s1 <= s2

# S3 method for class 'RPolarsSeries'
s1 >= s2

Arguments

other A Series or something a Series can be created from
op The chosen operator, must be one of “equal”, “not_equal”, “lt”, “gt”, “lt_eq” or “gt_eq”
s1 lhs Series
s2 rhs Series or any into Series

Value

Series

Examples

library(polars)

# We can either use `compare()`...
as_polars_series(1:5)$compare(as_polars_series(c(1:3, NA_integer_, 10L)), op = "equal")
#> polars Series: shape: (5,)
#> Series: '' [bool]
#> [
#>  true
#>  true
#>  true
#>  null
#>  false
#> ]
# ... or the more classic way
as_polars_series(1:5) == as_polars_series(c(1:3, NA_integer_, 10L))
#> polars Series: shape: (5,)
#> Series: '' [bool]
#> [
#>  true
#>  true
#>  true
#>  null
#>  false
#> ]