elco-quantities: Handling quantities in 'elco' objects

elco-quantitiesR Documentation

Handling quantities in elco objects

Description

Handling quantities in elco objects

Usage

## S3 method for class 'elco'
quantities(x)

## S3 replacement method for class 'elco'
quantities(x) <- value

## S3 method for class 'elco'
set_quantities(
  x,
  unit,
  errors = 0,
  ...,
  mode = units_options("set_units_mode")
)

## S3 method for class 'elco'
errors(x)

## S3 replacement method for class 'elco'
errors(x) <- value

## S3 method for class 'elco'
set_errors(x, value = 0)

## S3 method for class 'elco'
drop_errors(x)

## S3 method for class 'elco'
units(x)

## S3 replacement method for class 'elco'
units(x) <- value

## S3 method for class 'elco'
set_units(x, value, ..., mode = units_options("set_units_mode"))

Arguments

x

a numeric object, or object of class quantities, units or errors.

value

a list of two components: an object of class units or symbolic_units (see units), and a numeric vector of length 1 or the same length as x (see errors).

unit

a units object, or something coercible to one with as_units (see set_units).

errors

a numeric vector of length 1 or the same length as x (see set_errors).

...

passed on to other methods.

mode

if "symbols" (the default), then unit is constructed from the expression supplied. Otherwise, ifmode = "standard", standard evaluation is used for the supplied value This argument can be set via a global option units_options(set_units_mode = "standard")

Examples

## quantities

# quantities.elco
quantities(elco::chno$C)

# `quantities.elco<-`
x <- elco::chno$C
quantities(x) <- list("g/g", 0.1)

# set_quantities
set_quantities(elco::chno$C, unit = "g/g", errors = 0.1, mode = "standard")

## errors

# `errors.elco`
errors::errors(elco::chno$C)

# `errors.elco<-`
x <- elco::chno$C
errors::errors(x) <- 0.1

# set_errors
set_errors(elco::chno$C, value = 0.1)

# drop_errors.elco
errors::drop_errors(elco::chno$C)

## units

# units.elco
units(elco::chno$C)

# `units.elco<-`
x <- elco::chno$C
units(x) <- "g/g"

# set_units
set_units(elco::chno$C, value = "g/g", mode = "standard")


henningte/elco documentation built on May 21, 2022, 6:56 p.m.