Learn R Programming

functools (version 0.2.0)

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

Description

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

Usage

Compact(.x)

Arguments

.x
A vector.

Value

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab