Skip to content

Drop nulls (missing values)

Source code

Description

Drop all rows that contain nulls (which correspond to NA in R).

Usage

<LazyFrame>$drop_nulls(subset = NULL)

Arguments

subset A character vector with the names of the column(s) for which nulls are considered. If NULL (default), use all columns.

Value

LazyFrame

Examples

library(polars)

tmp = mtcars
tmp[1:3, "mpg"] = NA
tmp[4, "hp"] = NA
tmp = pl$LazyFrame(tmp)

# number of rows in `tmp` before dropping nulls
tmp$collect()$height
#> [1] 32
tmp$drop_nulls()$collect()$height
#> [1] 28
tmp$drop_nulls("mpg")$collect()$height
#> [1] 29
tmp$drop_nulls(c("mpg", "hp"))$collect()$height
#> [1] 28