Overloaded arithmetic operators for FLCore classes

# S4 method for numeric,FLArray
Arith(e1, e2)

# S4 method for FLArray,numeric
Arith(e1, e2)

# S4 method for FLArray,FLArray
Arith(e1, e2)

# S4 method for FLPar,FLPar
Arith(e1, e2)

# S4 method for FLArray,FLPar
Arith(e1, e2)

# S4 method for FLPar,FLArray
Arith(e1, e2)

Details

These methods apply the standard arithmetic operators included in the Arith group ("+", "-", "*", "^", " "/"), so that they return an object of the appropriate class.

When the operation involves objects of two classes (e.g. FLPar and FLQuant), the class is the returned object is that of the more complexs object, in this case FLQuant.

See also

methods::Arith base::Arithmetic

Examples

flq <- FLQuant(rlnorm(90), dim=c(3,10), units='kg') flp <- FLPar(a=99) # FLQuant and numeric flq * 25
#> An object of class "FLQuant" #> , , unit = unique, season = all, area = unique #> #> year #> quant 1 2 3 4 5 6 7 8 #> 1 38.2087 24.0653 17.5405 18.5828 8.6897 12.5327 31.3747 6.1686 #> 2 72.3835 40.6511 64.4071 16.9737 11.2834 14.3011 66.5086 32.3759 #> 3 71.3494 133.1876 93.2890 11.3981 4.3172 14.6174 20.2873 16.0720 #> year #> quant 9 10 #> 1 44.1448 4.6394 #> 2 209.7101 32.0814 #> 3 38.2343 73.0916 #> #> units: kg
# Two FLQuant objects flq + flq
#> An object of class "FLQuant" #> , , unit = unique, season = all, area = unique #> #> year #> quant 1 2 3 4 5 6 7 8 #> 1 3.05670 1.92523 1.40324 1.48662 0.69518 1.00261 2.50998 0.49348 #> 2 5.79068 3.25208 5.15257 1.35789 0.90267 1.14408 5.32069 2.59007 #> 3 5.70795 10.65501 7.46312 0.91184 0.34537 1.16939 1.62298 1.28576 #> year #> quant 9 10 #> 1 3.53159 0.37116 #> 2 16.77681 2.56652 #> 3 3.05875 5.84733 #> #> units: kg
# FLQuant and FLPar flq / flp
#> An object of class "FLQuant" #> , , unit = unique, season = all, area = unique #> #> year #> quant 1 2 3 4 5 6 7 #> 1 0.0154379 0.0097234 0.0070871 0.0075082 0.0035110 0.0050637 0.0126767 #> 2 0.0292458 0.0164247 0.0260231 0.0068580 0.0045590 0.0057782 0.0268721 #> 3 0.0288280 0.0538132 0.0376925 0.0046053 0.0017443 0.0059060 0.0081969 #> year #> quant 8 9 10 #> 1 0.0024923 0.0178363 0.0018745 #> 2 0.0130812 0.0847314 0.0129622 #> 3 0.0064937 0.0154482 0.0295320 #> #> units: kg