Skip to contents

Scan a data.frame or tibble and identify columns that contain any "void" values. Void values include NA, NULL, and "", which can be toggled via parameters.

Usage

cols_with_void(
  data,
  include_na = TRUE,
  include_null = TRUE,
  include_empty_str = TRUE,
  return_names = TRUE
)

Arguments

data

A data.frame or tibble.

include_na

Logical. Detect NA if TRUE. Default: TRUE.

include_null

Logical. Detect NULL if TRUE. Default: TRUE.

include_empty_str

Logical. Detect "" if TRUE. Default: TRUE.

return_names

Logical. If TRUE (default), return column names; else logical vector.

Value

A character vector (column names) or logical vector indicating void presence per column.

Examples

df <- data.frame(name = c("A", "", "C"), score = c(1, NA, 3), id = 1:3)
cols_with_void(df)
#> [1] "name"  "score"
cols_with_void(df, return_names = FALSE)
#>  name score    id 
#>  TRUE  TRUE FALSE