Learn R Programming

photobiology (version 0.10.6)

Extract_mspct: Extract or replace members of a collection of spectra

Description

Just like extraction and replacement with indexes for base R lists, but preserving the special attributes used in spectral classes.

Usage

# S3 method for generic_mspct
[(x, i, drop = NULL)

# S3 method for generic_mspct [(x, i) <- value

# S3 method for generic_mspct $(x, name) <- value

# S3 method for generic_mspct [[(x, name) <- value

Arguments

x

Collection of spectra object from which to extract member(s) or in which to replace member(s)

i

Index specifying elements to extract or replace. Indices are numeric or character vectors. Please, see Extract for more details.

drop

If TRUE the result is coerced to the lowest possible dimension (see the examples). This only works for extracting elements, not for the replacement.

value

A suitable replacement value: it will be repeated a whole number of times if necessary and it may be coerced: see the Coercion section. If NULL, deletes the column if a single column is selected.

name

A literal character string or a name (possibly backtick quoted). For extraction, this is normally (see under 'Environments') partially matched to the names of the object.

Value

An object of the same class as x but containing only the subset of members that are selected.

Details

This method is a wrapper on base R's extract method for lists that sets additional attributes used by these classes.