Section 12 R Atomic Class: Double
A double vector stores regular numbers
It can include both negative and positive, large or small, with or without decimal places
It is a historical anomaly that R has two names for its floating-point vectors, double and numeric (and formerly had real).
The potential confusion is that R has used mode
numeric
to meandouble
orinteger
, which conflicts with the S4 usage.R class
double
is accurate up to 16 significant digits.Function to identify the object type:
class, typeof, mode
Other functions to check the object type as double, numeric:
is.double
,is.numeric
12.1 Examples
<- 3.4
x
xclass(x)
typeof(x)
is.double(x)
<- 1
y
yclass(y)
<- pi
z
zclass(z)
is.double(z)
<- 1.5e05
a
aclass(a)
is.double(a)
<- 1.9e-5
b
bclass(b)
is.numeric(b)
<- 2^5
c
cclass(c)
is.numeric(c)
<- 0
d
dclass(d)
is.numeric(d)
<- 1
m <- 6L
n <- m+n
p <- m*n
q
p; qclass(p)
class(q)