This is principally a helper function for ‘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 ‘F’, ‘T’, ‘FALSE’, ‘TRUE’ or 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.