char_to_na: Replace character strings with NA.

Description Usage Arguments Value Examples

Description

This utility function is used to clean non-standard missing values. Converts the supplied char_string (default = "") to NA.

Usage

1
char_to_na(dt, char_string = "")

Arguments

dt

A vector, matrix or data frame.

char_string

A character string. Default = "".

Value

A copy of the input with all target strings replaced by NA.

Examples

1
2
3
4
char_to_na(c("foo", "", "bar"))
char_to_na(matrix(c("foo", "", "bar")))
char_to_na(data.frame(x = c("foo", ""), b = c("", "bar")))
char_to_na(data.frame(x = c("foo", "_"), b = c("_", "bar")), char_string = "_")

julianhatwell/arulesimp documentation built on May 11, 2019, 4:17 p.m.