rational-extract: Extract from a rational vector

rational-extractR Documentation

Extract from a rational vector

Description

Extract from a rational vector

Usage

## S4 method for signature 'rationalS4'
x[i, j, ..., drop = TRUE]

## S4 replacement method for signature 'rationalS4'
x[i, j, ...] <- value

## S4 method for signature 'rationalS4'
x[[i, ..., drop]]

## S4 replacement method for signature 'rationalS4'
x[[i, j, ...]] <- value

## S3 method for class 'rationalS3'
x[i, ..., drop = TRUE]

## S3 replacement method for class 'rationalS3'
x[i, ...] <- value

## S3 method for class 'rationalS3'
x[[i, ..., exact = TRUE]]

## S3 replacement method for class 'rationalS3'
x[[i, ...]] <- value

## S3 method for class 'rationalR6'
x[i, ..., drop = TRUE]

## S3 replacement method for class 'rationalR6'
x[i, ...] <- value

## S3 method for class 'rationalR6'
x[[i, ..., exact = TRUE]]

## S3 replacement method for class 'rationalR6'
x[[i, ...]] <- value

## S3 method for class ''rational::rationalS7''
x[i, ..., drop = TRUE]

## S3 replacement method for class ''rational::rationalS7''
x[i, j, ...] <- value

## S3 method for class ''rational::rationalS7''
x[[i, j, ..., drop]]

## S3 replacement method for class ''rational::rationalS7''
x[[i, j, ...]] <- value

Arguments

x

the rational number

i

index specifying elements

j

index specifying elements

...

indices specifying elements to extract or replace. Indices are numeric or character vectors or empty (missing) or NULL.

drop

For matrices and arrays. If TRUE the result is coerced to the lowest possible dimension (see the examples). This only works for extracting elements, not for the replacement. See drop for further details.

value

the replacement value

exact

controls partial matching when extracting by character

See Also

Extract for more full descriptions

Examples

  a <- rational(c(3L, 5L, 6L), c(4L, 5L, 7L), "S4")
  stopifnot(a[2]@n == 5L)
  stopifnot(all(a[2:3]@n == c(5,6)))
  a <- rational(c(3L, 5L, 6L), c(4L, 5L, 7L), "S3")
  stopifnot(a[2]$n == 5L)
  stopifnot(all(a[2:3]$n == c(5,6)))
  a <- rational(c(3L, 5L, 6L), c(4L, 5L, 7L), "R6")
  stopifnot(a[2]$getNumerator() == 5L)
  stopifnot(all(a[2:3]$n == c(5,6)))

bertcarnell/rational documentation built on Aug. 1, 2024, 8:14 p.m.