ID EN
Data Types & Classes

double

R Base 3.6.2

Create, coerce to or test for a double-precision vector.

Syntax

R
double(length = 0)
as.double(x, …)
is.double(x)<p></p><p>single(length = 0)
as.single(x, &#8230;)</p>

Arguments

Parameter Description
length A non-negative integer specifying the desired length. Double values will be coerced to integer: supplying an argument of length other than one is an error.
x object to be coerced or tested.
&#8230; further arguments passed to or from other methods.

Return Value

double creates a double-precision vector of the specified length. The elements of the vector are all equal to 0. as.double attempts to coerce its argument to be of double type: like as.vector it strips attributes including names. (To ensure that an object is of double type without stripping attributes, use storage.mode.) Character strings containing optional whitespace followed by either a decimal representation or a hexadecimal representation (starting with 0x or 0X) can be converted, as can sp

Details

double creates a double-precision vector of the specified length. The elements of the vector are all equal to 0. It is identical to numeric. as.double is a generic function. It is identical to as.numeric. Methods should return an object of base type "double". is.double is a test of double type. R has no single precision data type. All real numbers are stored in double precision format. The functions as.single and single are identical to as.double and double except they set the attribute Csingle that is used in the .C and .Fortran interface, and they are intended only to be used in that context.

Examples

Example
R
# NOT RUN {
is.double(1)
all(double(3) == 0)
# }

See Also

integer numeric storage.mode.