Learn R Programming

Brobdingnag (version 1.3-1)

as.numeric: Coerces to numeric or complex form

Description

Coerces an object of class brob to numeric, or an object of class glub to complex

Usage

# S4 method for brob
as.numeric(x)
# S4 method for glub
as.numeric(x)
# S4 method for brob
as.complex(x)
# S4 method for glub
as.complex(x)

Arguments

x

Object of class brob or glub

Author

Robin K. S. Hankin

Details

Function as.numeric() coerces a brob to numeric; if given a glub, the imaginary component is ignored (and a warning given).

Function as.complex() coerces to complex.

Examples

Run this code
a <- as.brob(1:10)
a <- cbrob(a, as.brob(10)^1e26)
a
as.numeric(a)

as.complex(10i + a)

Run the code above in your browser using DataLab