Learn R Programming

fractional (version 0.1.3)

vfractional: Vectorized form for fractional

Description

A function which allows any or all of the first three arguments of fractional to be vectors, with short vectors recycled in the usual way. Note that the return value is a character string vector and may not be used in arithmetic operations

Usage

vfractional(x, eps = 1e-06, maxConv = 20)

Arguments

x
as for fractional
eps
as for fractional, but may be a vector
maxConv
as for fractional but may be a vector

Value

A character string vector of class "charFrac"

Examples

Run this code
oldOpt <- options(scipen = 15)
pi_approx <- vfractional(base::pi, eps = 0, maxConv = 1:10)
within(data.frame(pi_approx, stringsAsFactors = FALSE), {
  value = numerical(pi_approx)
  error = signif(base::pi - value, 3)
  n = seq_along(value) - 1
})[, c("n", "pi_approx", "value", "error")]
options(oldOpt)

Run the code above in your browser using DataLab