elco-cast: Cast an object to an 'elco' object

elco-castR Documentation

Cast an object to an elco object

Description

Cast an object to an elco object

Usage

elco_as_elco(x, ...)

## S3 method for class 'quantities'
elco_as_elco(x, el_symbol, ...)

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

## S3 method for class 'elco'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

An object to be converted to class elco or and elco object to be converted to a different class.

...

Additional arguments passed on to methods.

el_symbol

A character vector representing a chemical element symbol to set for the elco object x gets converted to.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method.

Value

  • elco_as_elco returns x converted to an object of class elco.

  • as.data.frame.elco returns x converted to a data frame.

Examples

# elco_as_elco.quantities
elco::chno$C %>%
  elco_drop_elco() %>%
  elco_as_elco(el_symbol = "C")

# elco_as_elco.elco
elco::chno$C %>%
  elco_as_elco()

# elco_as_elco.elco
elco::chno$C %>%
  as.data.frame() %>%
  setNames("C")


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