salt {salty} | R Documentation |
Salt vectors with common data problems
Description
These are easy-to-use wrapper functions that call either salt_insert (for including new characters) or salt_replace (for salting that requires replacement of specific characters) with sane defaults.
Usage
salt_punctuation(x, p = 0.2, n = 1)
salt_letters(x, p = 0.2, n = 1)
salt_whitespace(x, p = 0.2, n = 1)
salt_digits(x, p = 0.2, n = 1)
salt_ocr(x, p = 0.2, rep_p = 0.1)
salt_capitalization(x, p = 0.1, rep_p = 0.1)
salt_decimal_commas(x, p = 0.1, rep_p = 0.1)
Arguments
x |
A vector. This will always be coerced to character during salting. |
p |
A number between 0 and 1. Percent of values in |
n |
A positive integer. Number of times to add new values from
|
rep_p |
A number between 0 and 1. Probability that a given match should be replaced in one of the selected values. |
Details
For a more fine-grained control over how characters are added and whether , see the documentation for salt_insert, salt_substitute, salt_replace, and salt_delete.
Functions
-
salt_punctuation
: Punctuation characters -
salt_letters
: Upper- and lower-case letters -
salt_whitespace
: Spaces -
salt_digits
: 0-9 -
salt_ocr
: Replace some substrings with common OCR problems -
salt_capitalization
: Flip capitalization of letters -
salt_decimal_commas
: Flip decimals to commas and vice versa