R/Compact.R

Defines functions Compact

Documented in Compact

#' Filter NA and NULL values out of a vector, list, or data.frame.
#'
#' \code{Compact()} takes a vector \code{.x} and returns it with all NULL and
#' NA values filtered out.
#'
#' @param .x A vector.
#' @return Vector .x but with all NULL and NA values filtered out.
#' @examples
#' # 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)
#'
#' @export
Compact <- function(.x) return(base::Filter(Existy, .x))
paulhendricks/functools documentation built on May 24, 2019, 8:41 p.m.