Extract: Extract

ExtractR Documentation

Extract

Description

Extract or replace parts of an FLR Object

Usage

## S4 method for signature 'FLArray,ANY,ANY,ANY'
x[i, j, k, l, m, n, ..., drop = FALSE]

## S4 method for signature 'FLArray,array,missing,missing'
x[i]

## S4 replacement method for signature 'FLArray,ANY,ANY,ANY'
x[i, j, k, l, m, n, ...] <- value

## S4 replacement method for signature 'FLArray,ANY,ANY,FLArray'
x[i, j, k, l, m, n, ...] <- value

## S4 method for signature 'FLQuant'
x$name

## S4 method for signature 'FLQuantDistr,ANY,ANY,ANY'
x[i, j, k, l, m, n]

## S4 method for signature 'FLQuantDistr,array,missing,missing'
x[i]

## S4 method for signature 'FLPar,ANY,ANY,ANY'
x[i, j, k, l, m, n, ..., drop = FALSE]

## S4 method for signature 'FLPar,array,missing,missing'
x[i]

## S4 replacement method for signature 'FLPar,ANY,ANY,ANY'
x[i, j, k, l, m, n, ...] <- value

## S4 method for signature 'FLPar'
x$name

## S4 replacement method for signature 'FLPar'
x$name <- value

## S4 method for signature 'FLComp,ANY,ANY,ANY'
x[i, j, k, l, m, n, ..., drop = FALSE]

## S4 replacement method for signature 'FLComp,ANY,ANY,ANY'
x[i, j, k, l, m, n, ...] <- value

## S4 method for signature 'FLStock,ANY,ANY,ANY'
x[i, j, k, l, m, n, ..., drop = FALSE]

## S4 replacement method for signature 'FLStock,ANY,ANY,FLStock'
x[i, j, k, l, m, n, ...] <- value

## S4 method for signature 'FLI,ANY,ANY,ANY'
x[i, j, k, l, m, n, ..., drop = FALSE]

## S4 method for signature 'predictModel,ANY,missing,ANY'
x[i, k, l, m, n, ..., drop = FALSE]

## S4 replacement method for signature 'FLlst,ANY,missing'
x[[i, j]] <- value

## S4 replacement method for signature 'FLlst'
x$name <- value

## S4 replacement method for signature 'FLlst,ANY,missing,ANY'
x[i, j] <- value

## S4 method for signature 'FLlst,ANY,missing,ANY'
x[i, drop]

Arguments

x

object from which to extract or replace element(s)

i, j, k, l, m, n

indices specifying elements to extract or replace on any of the six dimensions.

...

indices specifying elements to extract or replace by dimension name.

drop

If 'TRUE' the result is coerced to the lowest possible dimension, and so might change class (e.g. drop='TRUE' on an FLQuant might return an array of less dimensions, a matrix or a vector.

value

An object of the same class, or simpler if drop=TRUE, than 'x'.

name

See Extract for further details.

Details

Operators acting on FLQuant, FLCohort, FLPar, FLComp, and derived classes to extract or replace sections of an object.

Please note the differences between referencing sections of an object by position using values of class numeric, or by using dimnames of class character. See examples below.

All classes that are derived from FLComp (for example, FLStock and FLBiol) can be subset along the six dimensions of their FLQuant slots.

Classes that are derived from FLlst (for example, FLStocks and FLBiols) can be subset in a similar way to ordinary list objects.

'$' for the FLPar and FLQuant classes operate only along the first dimension ('params' or 'quant'), and are provided to be used specially in formulas.

Generic function

x,i,j,drop

[<-(x,i,j,value)

[[<-(x,i,j,value)

\$<-(x,name,value)

Author(s)

The FLR Team

See Also

Extract

Examples


flq <- FLQuant(rnorm(200), dimnames=list(age=0:4, year=1991:2000,
  season=1:4))

# Extracting by position...
  flq[1,]
  flq[,1:5]
  flq[1:2,,,c(1,3)]

# ...by dimnames
  flq['0',]
  flq[,'1991']
  flq[,as.character(1991:1995),,'1']

# Dimensions of length one can be drop
  flq[1, drop=TRUE]

# Replacing part of the object
  flq['0',,,1]<-0


flr/FLCore documentation built on May 4, 2024, midnight