normalize: Normalize Text

View source: R/normalize.R

normalizeR Documentation

Normalize Text

Description

Construct a standardized string from values passed to ...

Usage

normalize(...)

Arguments

...

Any number of vectors containing atomic elements. Each vector is normalized as a paragraph.

  • Elements are coerced to character values.

  • NA values and empty strings are discarded.

  • Multi-line strings are supported and encouraged. Blank lines are interpreted (two or more newline characters) as paragraph separators.

Details

Input text can written in a variety of ways using single-line and multi-line strings. Values passed to ... are normalized (to ensure their consistency) and collapsed to a single character string using the standard paragraph separator. The latter is defined as two newline characters ("\n\n").

  1. NA values and empty strings are discarded before reducing ... to a character string.

  2. Whitespaces (tabs, newlines, and repeated spaces) characters are replaced by a single space. Paragraph separators are preserved.

  3. Leading or trailing whitespaces are stripped.

Value

A character string, possibly empty.


transltr documentation built on April 3, 2025, 9:33 p.m.