Filter NA and NULL values out of a vector, list, or data.frame.

Share:

Description

Compact() takes a vector .x and returns it with all NULL and NA values filtered out.

Usage

1
Compact(.x)

Arguments

.x

A vector.

Value

Vector .x but with all NULL and NA values filtered out.

Examples

1
2
3
4
5
6
# Removes all null elements from a vector:
a <- list(NULL, 1, 5, NULL)
Compact(a)

b <- c(1, 2, 0, 4, NULL, 1, 3, NULL)
Compact(b)