Convert a character vector to logical, integer, numeric, complex or factor as appropriate.
a character vector.
a vector of strings which are to be interpreted as
logical. See ‘Details’.
the character to be assumed for decimal points.
string indicating how to convert numbers whose
conversion to double precision would lose accuracy, typically when
This is principally a helper function for
Given a character vector, it attempts to convert it to logical,
integer, numeric or complex, and failing that converts it to factor
as.is = TRUE. The first type that can accept all the
non-missing values is chosen.
Vectors which are entirely missing values are converted to logical,
NA is primarily logical.
Vectors containing just
and values from
na.strings are converted to logical. Vectors
containing optional whitespace followed by decimal constants
representable as R integers or values from
converted to integer. Other vectors containing optional whitespace
followed by other decimal or hexadecimal constants (see
(ignoring case) or values from
na.strings are converted to
numeric. Where converting inputs to numeric or complex would result
in loss of accuracy they can optionally be returned as strings (for
as.is = TRUE) or factors.
Since this is a helper function, the caller should always pass an
appropriate value of
An atomic vector or (for
as.is = FALSE) a factor.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.