elco-extract: Extract or replace parts of an 'elco' object

elco-extractR Documentation

Extract or replace parts of an elco object

Description

Extract or replace parts of an elco object

Usage

## S3 method for class 'elco'
x[i]

## S3 method for class 'elco'
x[[i]]

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

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

Arguments

x

An elco object to subset values from or where to replace values.

i, j, ...

indices specifying elements to extract or replace. See base::Extract.

value

An object of class elco which replaces elements in x.

Value

An object of class elco with subsetted or replaced values.

Examples

elco::chno$C[1]

elco::chno$C[[1]]

x <- elco::chno$C
y <- elco::chno$N
z <- NA_real_

# returns `elco` object because both have the same el_symbol attribute
x[1] <- x[2]
class(x)

# strips off the elco class because the el_symbol attribute differs
y[1] <- x[2]
class(y)

# strips off the elco class because z is no elco object
x[1] <- z
class(x)

x <- elco::chno$C
y <- elco::chno$N

# returns `elco` object because both have the same el_symbol attribute
x[[1]] <- x[2]
class(x)

# strips off the elco class because the el_symbol attribute differs
y[[1]] <- x[2]
class(y)


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