replace_number: Replace Numbers With Text Representation

Description Usage Arguments Value Note References See Also Examples

View source: R/replace_number.R

Description

Replaces numeric represented numbers with words (e.g., 1001 becomes one thousand one).

Usage

1
replace_number(text.var, num.paste = TRUE, remove = FALSE)

Arguments

text.var

The text variable.

num.paste

logical. If TRUE a the elements of larger numbers are separated with spaces. If FALSE the elements will be joined without spaces.

remove

logical. If TRUE numbers are removed from the text.

Value

Returns a vector with abbreviations replaced.

Note

The user may want to use replace_ordinal first to remove ordinal number notation. For example replace_number would turn "21st" into "twenty onest", whereas replace_ordinal would generate "twenty first".

References

Fox, J. (2005). Programmer's niche: How do you spell that number? R News. Vol. 5(1), pp. 51-55.

See Also

bracketX, qprep, replace_abbreviation, replace_contraction, replace_symbol, replace_ordinal

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
x <- c("I like 346,457 ice cream cones.", "They are 99 percent good")
y <- c("I like 346457 ice cream cones.", "They are 99 percent good")
replace_number(x)
replace_number(y)
replace_number(x, FALSE)
replace_number(x, remove=TRUE)

## End(Not run)

trinker/qdap documentation built on Sept. 30, 2020, 6:28 p.m.