Description Usage Arguments Value Methods (by class) Examples
Convert an object of class "fractional"
or "charFrac"
to a purely
numeric object. This is effectively a method function for the .Primitive
generic function as.numeric
but written as a separate function for purely
technical reasons.
1 2 3 4 5 6 7 8 9 10 |
vulgar |
character string form of a class 'fractional' object. |
A numeric
object as represented by its (usually fractional
) display.
fractional
: Method for "fractional"
objects
charFrac
: Method for "charFrac"
objects
default
: Default method for numerical
generic
1 2 3 4 5 6 7 8 9 10 | suppressPackageStartupMessages(library(dplyr))
m <- 2*diag(5)
m[abs(row(m) - col(m)) == 1] <- -1
m ## How much roundoff error does inverting entail?
(mi <- solve(m) %>% fractional) ## patterned inverse
mi * max(denominators(mi)) ## clearer pattern
m1 <- solve(mi)
range(m1 - m) ## roundoff still present
m2 <- m1 %>% numerical ## remove roundoff error - hopefully!
identical(m2, m) ## no roundoff
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.