Learn R Programming

clinpubr (version 1.1.1)

value_initial_cleaning: Preliminarily cleaning string vectors

Description

Cleaning illegal characters in string vectors that store numerical values. The function is useful for cleaning electrical health records in Chinese.

char_initial_cleaning() will convert full-width characters to half-width characters, removes whitespace at the start and end, replaces all internal whitespace with a single space, and replace empty strings with NA.

value_initial_cleaning() will additionally remove all spaces and extra dots.

Usage

value_initial_cleaning(x, remove_inequal = FALSE)

char_initial_cleaning(x)

Value

A string vector with less illegal characters.

Arguments

x

A string vector.

remove_inequal

A logical value. If TRUE, remove comparison symbols such as <, > from the string

Examples

Run this code
x <- c("\uFF11\uFF12\uFF13", "11..23", "\uff41\uff42\uff41\uff4e\uff44\uff4f\uff4e", 
       "hello world ")
value_initial_cleaning(x)
char_initial_cleaning(x)

Run the code above in your browser using DataLab