Learn R Programming

albatross (version 0.1-1)

[.feem: Extract or replace parts of FEEM objects

Description

Extract or replace parts of FEEM spectra. Returns FEEM objects unless dimensions should be dropped. When assigning from a FEEM object, requires wavelenths to match and warns if scale factors differ.

Usage

# S3 method for feem
[(x, i, j, drop = TRUE)
  # S3 method for feem
[(x, i, j) <- value

Arguments

x

A FEEM object.

i, j

Row and column indices, respectively. As in usual R subsetting, may be integer, logical or character vectors, or missing.

drop

Coerce result to the lowest possible dimension (dropping the feem class if so). This only makes sence for extracting, not replacement.

value

An array-like object to assign values from. When assigning from FEEM objects, wavelengths are required to match and warnings are issued if scale factors don't match.

Value

For [: If isTRUE(drop) and at least one of the index arguments chooses only one element along its axis, a named numeric vector. Otherwise, a FEEM object.

For [<-: a FEEM object.

See Also

feem, [.feemcube

Examples

Run this code
# NOT RUN {
  (z <- feem(matrix(1:40, ncol = 8), 66 + 1:5, 99 + 1:8, 3))
  str(z[1:4, 1:2])
  str(z[1,, drop = TRUE])
  z[2:3, 4:5] <- feem(matrix(1:4, 2), 66 + 2:3, 99 + 4:5, 3)
  z
# }

Run the code above in your browser using DataLab