sanitizeNa: Sanitize NA values

sanitizeNaR Documentation

Sanitize NA values

Description

Standardize empty strings (""), character NAs ("NA"), and NULL values inside a character vector to NA_character_. Other atomic data types are returned unmodified.

Usage

sanitizeNa(object, ...)

## S4 method for signature 'DFrame'
sanitizeNa(object)

## S4 method for signature 'atomic'
sanitizeNa(object)

## S4 method for signature 'character'
sanitizeNa(object)

## S4 method for signature 'data.frame'
sanitizeNa(object)

## S4 method for signature 'factor'
sanitizeNa(object)

Arguments

object

Object.

...

Additional arguments.

Value

Modified object. Sanitized to contain proper NA values.

Note

Updated 2023-09-20.

Examples

## character ====
from <- as.character(c(1L, "x", "", "NA", "NULL"))
print(from)
to <- sanitizeNa(from)
print(to)

## DFrame ====
from <- S4Vectors::DataFrame(
    "a" = c("foo", ""),
    "b" = c(NA, "bar"),
    row.names = c("c", "d")
)
print(from)
to <- sanitizeNa(from)
print(to)

acidgenomics/pipette documentation built on Jan. 31, 2024, 10:32 p.m.