na_omitlist: Remove NA from list

View source: R/na_omitlist.R

na_omitlistR Documentation

Remove NA from list

Description

This functions removes NAs from a list. With recursive = TRUE, NAs within each list's elements are removed as well.

Usage

na_omitlist(y = list(), recursive = FALSE)

Arguments

y

a list

recursive

logical. If TRUE, NAs within the list's elements are removed too.

Value

Returns the list without NAs.

Author(s)

Jakob Gepp

Examples

y <- list(c(1:3), letters[1:4], NA, c(1, NA), list(c(5:6, NA), NA, "A"))
na_omitlist(y, recursive = TRUE)

# [[1]]
# [1] 1 2 3
#
# [[2]]
# [1] "a" "b" "c" "d"
#
# [[3]]
# [1] 1
#
# [[4]]
# [[4]][[1]]
# [1] 5 6
#
# [[4]][[2]]
# [1] "A"


STATWORX/helfRlein documentation built on Feb. 12, 2024, 2:21 a.m.