Extract.quantities: Extract or Replace Parts of an Object

Extract.quantitiesR Documentation

Extract or Replace Parts of an Object

Description

S3 operators to extract or replace parts of quantities objects.

Usage

## S3 method for class 'quantities'
x[...]

## S3 method for class 'quantities'
x[[...]]

## S3 replacement method for class 'quantities'
x[...] <- value

## S3 replacement method for class 'quantities'
x[[...]] <- value

Arguments

x

object from which to extract element(s) or in which to replace element(s).

...

additional arguments to be passed to base methods (see Extract).

value

typically an array-like R object of a similar class as x.

Examples

x <- set_quantities(1:3, m/s, 0.1)
y <- set_quantities(4:6, m/s, 0.2)
(z <- rbind(x, y))
z[2, 2]
z[2, 2] <- -1
errors(z[[1, 2]]) <- 0.8 # assumes same unit
errors(z[[2, 2]]) <- set_units(80, cm/s)
z[, 2]


quantities documentation built on Sept. 11, 2024, 7:19 p.m.