essentials-package | R Documentation |
Functions for converting objects to scalars (vectors of length 1) and a more inclusive definition of data that can be interpreted as numbers (numeric and complex alike).
The four most important functions from this package are as.numbers
,
is.numbers
, as.scalar
and aslength1
.
as.numbers
coerces its argument to type double or complex.
is.numbers
tests if its argument is interpretable as numbers.
as.scalar
coerces its argument to an scalar (an atomic vector of
length 1). It strips attributes including names.
aslength1
coerces its argument to a vector of length 1 (not
necessarily atomic). It strips attributes from arguments that are not
vectors, but preserves names for arguments that are vectors.
Iris Simmons [aut, cre]
Maintainer: Iris Simmons <ikwsimmo@gmail.com>
as.numbers("4")
as.numbers("4+0i") # imaginary component is removed
as.numbers("4+1i")
is.numbers(4L)
is.numbers(4)
is.numbers(4+1i)
as.scalar(1:100)
as.scalar(as.list(1:100)) # coerced to NA_character_ since argument isn't atomic
aslength1(1:100) # identical to as.scalar(1:100)
aslength1(as.list(1:100)) # returns a list of length 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.