Description Usage Arguments Details
Convert to and from proquints.
1 2 3 4 5 6 7 | int_to_proquint(x, use_cache = TRUE)
proquint_to_int(p, as = "numeric", use_cache = TRUE)
proquint_word_to_int(w, use_cache = TRUE, validate = TRUE)
int_to_proquint_word(i, use_cache = TRUE, validate = TRUE)
|
x |
An integer (or integer-like) value to convert to a proquint |
use_cache |
Because there are relatively few combinations per
word, and because constructing short strings is relatively
expensive in R, it may be useful to cache all 65536 possible
words. If |
p |
A character vector representing a proquint |
as |
The target data type for conversion from proquint. The
options are |
w |
A proquint word (five letter string) |
validate |
Validate the range of inputs? Because these functions are used internally, they can skip input validation. You can too if you promise to pass sanitised input in. If out-of-range values are passed in and validation is disabled the behaviour is undefined and subject to change. |
i |
An integer representing a single proquint word (in the range 0:65535) |
These functions try to be type safe and predictable about what they will and will not return.
For proquint_to_int
, because numeric overflow is a
possibility, it is important to consider whether a proquint can be
meaninfully translated into an integer or a numeric and the
functions will throw an error rather than failing in a more
insidious way (promoting the type or returning NA).
proquint_word_to_int
always retuns an integer vector of the
same length as the input.
Missing values are allowed; a missing integer representation of a
proquint will translate as NA_character_
and a missing
proquint will translate as NA_integer_
(if as =
"integer"
), NA_real_
, if as = "numeric"
or as
NULL
(if as = "bignum"
).
Names are always discarded. Future versions may gain an argument
named
with a default of FALSE
, but that setting to
TRUE
would preseve names. Let me know if this would be
useful.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.