blank2na: Replaces blank-ish elements of a factor or character vector...

Description Usage Arguments Value

View source: R/blank2na.R

Description

Replaces blank-ish elements of a factor or character vector to NA

Usage

1
blank2na(x, na.strings = c("", ".", "NA", "na", "N/A", "n/a", "NaN", "nan"))

Arguments

x

a vector of factor or character or any type

na.strings

case sensitive strings that will be coverted to NA. The function will do a trimws(x,'both') before conversion. If NULL, do only trimws, no conversion to NA.

Value

Returns a vector trimws (always for factor, character) and NA converted (if matching na.strings). Attributes will also be kept ('label','labels', 'value.labels').


emilBeBri/dttools documentation built on April 21, 2021, 5:44 a.m.