units-FLCore: Method units

units-FLCoreR Documentation

Method units

Description

units attribute for FLQuant and FLArray-derived objects

Usage

## S4 method for signature 'FLArray'
units(x)

## S4 replacement method for signature 'FLArray,character'
units(x) <- value

setunits(x, value)

## S4 method for signature 'FLPar'
units(x)

## S4 replacement method for signature 'FLPar,character'
units(x) <- value

## S4 method for signature 'FLComp'
units(x)

## S4 replacement method for signature 'FLComp,list'
units(x) <- value

## S4 replacement method for signature 'FLComp,character'
units(x) <- value

## S4 replacement method for signature 'FLComp,function'
units(x) <- value

Details

Objects of FLArray-based classes (e.g. FLQuant) contain a units attribute of class character. This should be used to store the corresponding units of measurement. This attribute can be directly accessed and modified using the units and units<- methods.

For complex objects, units will return a named list containing the attributes of all FLQuant slots. units of a complex object can be modified for all slots or a subset of them, by passing a named list with the new values. See examples below.

The complete set of units for a complex object can be obtained as a named list.

Assignment of units to the FLQuant slots of a complex object can be carried out passing a named list or character vector containing the units for the slots to be modified.

Generic function

units(x)

units<-(x,value)

Author(s)

The FLR Team

See Also

FLQuant, FLPar, FLCohort

Examples


flq <- FLQuant(rnorm(100), dim=c(5,20), units='kg')
units(flq)
units(flq) <- 't'
summary(flq)

# units for a complex object
  data(ple4)
  units(ple4)
  units(ple4) <- list(harvest='hr')

data(ple4)
units(ple4) <- list(harvest="hr")
units(ple4) <- c(harvest="hr")

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