complete_cases: Complete cases

Description Usage Arguments Value Examples

View source: R/dataframes.R

Description

Return completed cases of a data.frame

Usage

1
complete_cases(data, cols = NULL, invert = FALSE)

Arguments

data

A data.frame

cols

Colnames or numbers to remove NA values from; NULL (default) will use all columns

invert

Logical, if TRUE will return incomplete cases

Value

A data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x <- data.frame(
  a = 1:5,
  b = c(1, NA, 3, 4, 5),
  c = c(1, NA, NA, 4, 5)
)

complete_cases(x)
complete_cases(x, invert = TRUE) # returns the incomplete rows
complete_cases(x, "a")
complete_cases(x, "b")
complete_cases(x, "c")

mark documentation built on July 16, 2021, 9:07 a.m.