coerce_NA_text: Coerce textual NAs to true NA values

View source: R/coerce_NA_text.R

coerce_NA_textR Documentation

Coerce textual NAs to true NA values

Description

This function is designed to convert textual NAs to true NA values. It can operate on vectors, data frames, data frame like objects (e.g. tibbles), or matrices. It returns an object of the same class. The values that will be coerced to NAs can be provided as a character vector.

Usage

coerce_NA_text(
  x, NA_values = c("NA", "na", "N/A", "n/a", "", "."), 
  add_NA_values, verbose = FALSE)

Arguments

x

vector, matrix, or data frame containing the data to be coerced

NA_values

character vector, the values to be coerced to NAs.

add_NA_values

character vector, additional values (beyond NA_values) to coerce to NA. This argument simplifies keeping the default NA_values and adding one or more additional values to it

verbose

logical, whether to output information on data being coerced; if x is a data frame, the function will output the names of the columns with data being coerced.

Value

An object of the same type as the input data


mjdufort/miscHelpers documentation built on Feb. 4, 2024, 7:44 p.m.