type.convert(x, na.strings = "NA", as.is = FALSE, dec = ".", numerals = c("allow.loss", "warn.loss", "no.loss"))
NA
values. Blank fields are also considered to be
missing values in logical, integer, numeric or complex vectors.x
has more digits than can be stored in a double
.
numerals = "allow.loss"
, default:
numerals = "warn.loss"
:warning
about accuracy loss is signalled and the conversion happens as
with numerals = "allow.loss"
.
numerals = "no.loss"
:x
is not
converted to a number, but to a factor
or left as
character, depending on as.is
. This has been the only
behavior of R version 3.1.0.
as.is = FALSE
) a factor.
read.table
.
Given a character vector, it attempts to convert it to logical,
integer, numeric or complex, and failing that converts it to factor
unless 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,
since NA
is primarily logical.
Vectors containing just F
, T
, FALSE
, TRUE
and values from na.strings
are converted to logical. Vectors
containing optional whitespace followed by decimal constants
representable as R integers or values from na.strings
are
converted to integer. Other vectors containing optional whitespace
followed by other decimal or hexadecimal constants (see
NumericConstants), or NaN
, Inf
or infinity
(ignoring case) or values from na.strings
are converted to
numeric. As from R 3.1.0, where converting inputs to numeric or
complex would result in loss of accuracy they are returned as strings
(for as.is = TRUE
) or factors.
Since this is a helper function, the caller should always pass an
appropriate value of as.is
.
read.table