float (version 0.2-4)

converters: converters

Description

Convert between a numeric vector/matrix and a float vector/matrix.

Usage

fl(x, strict = FALSE)

dbl(x, strict = FALSE)

int(x, strict = FALSE)

as.float(x, strict = FALSE)

# S3 method for float32 as.double(x, ...)

# S3 method for float32 as.integer(x, ...)

# S4 method for float32 as.numeric(x, ...)

# S3 method for float32 as.vector(x, mode = "any")

# S3 method for float32 as.matrix(x, ...)

# S4 method for float32 typeof(x)

# S4 method for float32 storage.mode(x)

Arguments

x

A numeric or float vector/matrix.

strict

Should the function error if given the wrong kind of input? Otherwise it just silently returns the input.

mode, ...

Ignored.

Value

The data stored in the type of whatever was asked for (the opposite of the input).

Details

fl(), int(), and dbl() are shorthand for as.float(), as.integer(), and as.double(), respectively.

Examples

Run this code
# NOT RUN {
library(float)

x = matrix(1:30, 10, 3)
s = fl(x)

y = dbl(s)

all.equal(x, y)

# }

Run the code above in your browser using DataCamp Workspace