elco_new_elco: Creates an object of class 'elco'

View source: R/elco.R

elco_new_elcoR Documentation

Creates an object of class elco

Description

elco_new_elco is the constructor function for objects of class elco. An object of class elco is a numeric vector with each element representing a chemical element content value. It is a subclass of the quantities::quantities() class with an additional attribute "el_symbol" where the respective element symbol is stored.

Usage

elco_new_elco(x, el_symbol)

elco_drop_elco(x)

## S3 method for class 'elco'
print(x, ...)

Arguments

x

An object of class elco.

el_symbol

A character value representing the symbol for a chemical element. To check this, PeriodicTable::isSymb() is used.

...

Additional arguments, will be ignored.

Value

An object of class elco. This is identical to x, but has an additional attribute "el_symbol" and an additional class attribute "elco".

Returns the input object x. Prints its content as side effect.

Examples

library(quantities)

# store C content value as elco object
elco_new_elco(
  x = quantities::set_quantities(0.42, unit = "mol/g", errors = 0.002),
  el_symbol = "C"
)

print(elco::chno$C)


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