Skip to content

Drop missing values

Description

Drop missing values

Usage

## S3 method for class 'RPolarsLazyFrame'
na.omit(object, subset = NULL, ...)

# S3 method for class 'RPolarsDataFrame'
na.omit(object, subset = NULL, ...)

Arguments

object A DataFrame or LazyFrame
subset Character vector of column names to drop missing values from.
Not used.

Examples

library(polars)

df = pl$DataFrame(data.frame(a = c(NA, 2:10), b = c(1, NA, 3:10)))$lazy()
na.omit(df)
#> polars LazyFrame
#>  $describe_optimized_plan() : Show the optimized query plan.
#> 
#> Naive plan:
#> FILTER col("a").is_not_null().all_horizontal([col("b").is_not_null()]) FROM
#> DF ["a", "b"]; PROJECT */2 COLUMNS; SELECTION: "None"
na.omit(df, subset = "a")
#> polars LazyFrame
#>  $describe_optimized_plan() : Show the optimized query plan.
#> 
#> Naive plan:
#> FILTER col("a").is_not_null().all_horizontal() FROM
#> DF ["a", "b"]; PROJECT */2 COLUMNS; SELECTION: "None"
na.omit(df, subset = c("a", "b"))
#> polars LazyFrame
#>  $describe_optimized_plan() : Show the optimized query plan.
#> 
#> Naive plan:
#> FILTER [(col("a").is_not_null()) & (col("b").is_not_null())] FROM
#> DF ["a", "b"]; PROJECT */2 COLUMNS; SELECTION: "None"