Methods to compute totals over selected dimensions of FLQuant
objects
These methods return an object of same dimensions as the input but with the
sums along the first (yearTotals
) or second dimension
(quantTotals
). Although the names might appear contradictory, it must
be noted that what each method really returns are the totals over the
selected dimension.
Examples
flq <- FLQuant(rlnorm(100), dim=c(10,10))
quantTotals(flq)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6 7 8 9 10
#> 1 29.72 29.72 29.72 29.72 29.72 29.72 29.72 29.72 29.72 29.72
#> 2 10.50 10.50 10.50 10.50 10.50 10.50 10.50 10.50 10.50 10.50
#> 3 12.86 12.86 12.86 12.86 12.86 12.86 12.86 12.86 12.86 12.86
#> 4 40.20 40.20 40.20 40.20 40.20 40.20 40.20 40.20 40.20 40.20
#> 5 22.25 22.25 22.25 22.25 22.25 22.25 22.25 22.25 22.25 22.25
#> 6 10.40 10.40 10.40 10.40 10.40 10.40 10.40 10.40 10.40 10.40
#> 7 10.01 10.01 10.01 10.01 10.01 10.01 10.01 10.01 10.01 10.01
#> 8 11.39 11.39 11.39 11.39 11.39 11.39 11.39 11.39 11.39 11.39
#> 9 7.57 7.57 7.57 7.57 7.57 7.57 7.57 7.57 7.57 7.57
#> 10 31.49 31.49 31.49 31.49 31.49 31.49 31.49 31.49 31.49 31.49
#>
#> units: NA
# See how the values obtained by yearSums are being replicated
yearSums(flq)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1
#> 1 29.72
#> 2 10.50
#> 3 12.86
#> 4 40.20
#> 5 22.25
#> 6 10.40
#> 7 10.01
#> 8 11.39
#> 9 7.57
#> 10 31.49
#>
#> units: NA
# Get the proportions by quant
flq / quantTotals(flq)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6 7 8 9
#> 1 0.01023 0.47409 0.00525 0.03998 0.02383 0.25289 0.05358 0.00231 0.04892
#> 2 0.03086 0.11112 0.01174 0.14194 0.18326 0.06451 0.07643 0.08495 0.24569
#> 3 0.06614 0.06867 0.29438 0.26260 0.07426 0.03565 0.06832 0.01442 0.03910
#> 4 0.01149 0.03864 0.05541 0.11879 0.39762 0.05800 0.12611 0.02092 0.13613
#> 5 0.03437 0.00725 0.04639 0.47463 0.06513 0.05141 0.04521 0.02853 0.21485
#> 6 0.01348 0.15314 0.11469 0.27984 0.08541 0.03541 0.04460 0.07029 0.06860
#> 7 0.08931 0.05988 0.04078 0.00551 0.13142 0.12138 0.07521 0.02333 0.33385
#> 8 0.07608 0.04062 0.02189 0.02932 0.03823 0.10447 0.09593 0.27447 0.10596
#> 9 0.16448 0.18405 0.05075 0.05510 0.06761 0.18544 0.09877 0.02608 0.11062
#> 10 0.01423 0.01493 0.02987 0.01995 0.09938 0.00473 0.09559 0.02814 0.67446
#> year
#> quant 10
#> 1 0.08892
#> 2 0.04949
#> 3 0.07647
#> 4 0.03690
#> 5 0.03224
#> 6 0.13455
#> 7 0.11934
#> 8 0.21303
#> 9 0.05710
#> 10 0.01871
#>
#> units: NA
# or year
flq / yearTotals(flq)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6 7 8 9
#> 1 0.04827 0.62988 0.01487 0.04619 0.02595 0.45690 0.10331 0.00880 0.03452
#> 2 0.05145 0.05215 0.01174 0.05791 0.07048 0.04117 0.05205 0.11443 0.06123
#> 3 0.13506 0.03947 0.36058 0.13123 0.03498 0.02786 0.05699 0.02378 0.01193
#> 4 0.07335 0.06943 0.21217 0.18558 0.58550 0.14171 0.32887 0.10791 0.12991
#> 5 0.12140 0.00721 0.09831 0.41032 0.05307 0.06951 0.06525 0.08142 0.11346
#> 6 0.02225 0.07116 0.11356 0.11305 0.03252 0.02237 0.03008 0.09375 0.01693
#> 7 0.14193 0.02679 0.03887 0.00214 0.04818 0.07384 0.04883 0.02995 0.07931
#> 8 0.13755 0.02067 0.02374 0.01297 0.01594 0.07230 0.07085 0.40094 0.02864
#> 9 0.19760 0.06224 0.03657 0.01620 0.01874 0.08527 0.04848 0.02531 0.01987
#> 10 0.07115 0.02102 0.08959 0.02442 0.11464 0.00906 0.19529 0.11369 0.50420
#> year
#> quant 10
#> 1 0.21338
#> 2 0.04195
#> 3 0.07938
#> 4 0.11977
#> 5 0.05790
#> 6 0.11292
#> 7 0.09643
#> 8 0.19581
#> 9 0.03488
#> 10 0.04758
#>
#> units: NA