units attribute for FLQuant and FLArray-derived objects

# S4 method for FLArray
units(x)

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.

Generic function

units(x)

units<-(x,value)

See also

FLQuant, FLPar, FLCohort

Examples

flq <- FLQuant(rnorm(100), dim=c(5,20), units='kg') units(flq)
#> [1] "kg"
units(flq) <- 't' summary(flq)
#> An object of class "FLQuant" with: #> dim : 5 20 1 1 1 1 #> quant: quant #> units: t #> #> Min : -3.055447 #> 1st Qu.: -0.6755399 #> Mean : 0.02763819 #> Median : 0.09507502 #> 3rd Qu.: 0.6946924 #> Max : 3.076675 #> NAs : 0 %
# units for a complex object data(ple4) units(ple4)
#> $catch #> [1] "t" #> #> $catch.n #> [1] "10^3" #> #> $catch.wt #> [1] "kg" #> #> $discards #> [1] "t" #> #> $discards.n #> [1] "10^3" #> #> $discards.wt #> [1] "kg" #> #> $landings #> [1] "t" #> #> $landings.n #> [1] "10^3" #> #> $landings.wt #> [1] "kg" #> #> $stock #> [1] "t" #> #> $stock.n #> [1] "10^3" #> #> $stock.wt #> [1] "kg" #> #> $m #> [1] "m" #> #> $mat #> [1] "" #> #> $harvest #> [1] "f" #> #> $harvest.spwn #> [1] "" #> #> $m.spwn #> [1] "" #>
units(ple4) <- list(harvest='hr')