remove.erroneous.characters | R Documentation |
This function attempts to convert a character vector to a numeric or complex vector, replacing erroneous values based on a specified threshold.
remove.erroneous.characters(
x,
threshold.for.numeric = 0.8,
variable.should.be = "numeric",
value.for.missing = NULL,
...
)
x |
A character vector of values that should be a numeric vector but was coerced to a character due to a small number of entries. |
threshold.for.numeric |
A value between 0 and 1 specifying the maximum proportion of x that does not "look" numeric. If threshold.for.numeric = 0.1, then no more than 10 percentage of the values in x can be values that do not "look" numeric. |
variable.should.be |
A character string specifying the target variable type ("numeric" or "complex"). Defaults to "numeric". |
value.for.missing |
The value to replace missing or erroneous entries with. Defaults to NA_real_ for numeric and NA_complex_ for complex. |
... |
Additional arguments . |
A numeric or complex vector with erroneous entries replaced, or the original character vector if the proportion of erroneous values exceeds the threshold.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.