na_rm: Remove NAs from vectors, lists, matrices, and dataframes

View source: R/r_tools.R

na_rmR Documentation

Remove NAs from vectors, lists, matrices, and dataframes

Description

This is a wrapper around stats::na_omit() which hides its annoying printing behaviour when applied to a vector.

Usage

na_rm(obj)

Arguments

obj

(Vector/List/Matrix/Dataframe) The thing to remove NAs from.

Value

A copy of obj without NAs.

Examples

na_rm(c("a", NA, "b", NA, "c", "d"))

#> [1] "a" "b" "c" "d"


na_rm(data.frame(col1 = 1:5, col2 = c("a", NA, "c", "d", NA)))

#>   col1 col2
#> 1    1    a
#> 3    3    c
#> 4    4    d


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.