sanitizeNA: Sanitize NA values

Description Usage Arguments Value Note Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
sanitizeNA(object, ...)

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

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

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

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

## S4 method for signature 'DataFrame'
sanitizeNA(object)

Arguments

object

Object.

...

Additional arguments.

Value

Modified object. Sanitized to contain proper NA values.

Note

Updated 2021-02-11.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## character ====
from <- as.character(c(1L, "x", "", "NA", "NULL"))
print(from)
to <- sanitizeNA(from)
print(to)

## DataFrame ====
from <- 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 Sept. 27, 2021, 9:10 a.m.