deterge | R Documentation |
Cast values to desired data type.
deterge_to_double(x, bound_lower, bound_upper)
deterge_to_integer(x, bound_lower, bound_upper)
deterge_to_ascii(x, substitution_character)
x |
The input vector that needs to be cast/converted. Required. |
bound_lower |
Elements below this inclusive threshold will be set to |
bound_upper |
Elements above this inclusive threshold will be set to |
substitution_character |
If the character does not have an equivalent in ASCII, replace it with this character. Defaults to a question mark (i.e., '?'). |
The functions deterge_to_double()
and deterge_to_integer()
accept character representations of a number, and return a numeric
or integer
vector. Elements outside bound_lower
and bound_upper
are converted to NA_real_
/NA_integer_
.
The function deterge_to_ascii()
accepts a character vector and returns a character vector.
The encoding is changed to ASCII. Individual elements are allowed to be NA_character_
.
An array of values.
Will Beasley
The real work in deterge_to_ascii()
is performed by base::iconv()
.
base::iconv(x=x, from="latin1", to="ASCII//TRANSLIT", sub=substitution_character)
library(OuhscMunge)
deterge_to_double(c(NA, 1:10), 4, 8)
deterge_to_integer(c(NA, 1:10), 4L, 8L)
x <- c("Ekstr\xf8m", "J\xf6reskog", "bi\xdfchen Z\xfcrcher")
deterge_to_ascii(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.