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 object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6 7 8 9
#> 1 29.7234 29.7234 29.7234 29.7234 29.7234 29.7234 29.7234 29.7234 29.7234
#> 2 10.4986 10.4986 10.4986 10.4986 10.4986 10.4986 10.4986 10.4986 10.4986
#> 3 12.8588 12.8588 12.8588 12.8588 12.8588 12.8588 12.8588 12.8588 12.8588
#> 4 40.1999 40.1999 40.1999 40.1999 40.1999 40.1999 40.1999 40.1999 40.1999
#> 5 22.2456 22.2456 22.2456 22.2456 22.2456 22.2456 22.2456 22.2456 22.2456
#> 6 10.3951 10.3951 10.3951 10.3951 10.3951 10.3951 10.3951 10.3951 10.3951
#> 7 10.0079 10.0079 10.0079 10.0079 10.0079 10.0079 10.0079 10.0079 10.0079
#> 8 11.3852 11.3852 11.3852 11.3852 11.3852 11.3852 11.3852 11.3852 11.3852
#> 9 7.5651 7.5651 7.5651 7.5651 7.5651 7.5651 7.5651 7.5651 7.5651
#> 10 31.4908 31.4908 31.4908 31.4908 31.4908 31.4908 31.4908 31.4908 31.4908
#> year
#> quant 10
#> 1 29.7234
#> 2 10.4986
#> 3 12.8588
#> 4 40.1999
#> 5 22.2456
#> 6 10.3951
#> 7 10.0079
#> 8 11.3852
#> 9 7.5651
#> 10 31.4908
#>
#> units: NA
# See how the values obtained by yearSums are being replicated
yearSums(flq)
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1
#> 1 29.7234
#> 2 10.4986
#> 3 12.8588
#> 4 40.1999
#> 5 22.2456
#> 6 10.3951
#> 7 10.0079
#> 8 11.3852
#> 9 7.5651
#> 10 31.4908
#>
#> units: NA
# Get the proportions by quant
flq / quantTotals(flq)
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6 7
#> 1 0.0102262 0.4740858 0.0052518 0.0399841 0.0238343 0.2528938 0.0535763
#> 2 0.0308577 0.1111179 0.0117361 0.1419445 0.1832639 0.0645143 0.0764293
#> 3 0.0661400 0.0686662 0.2943833 0.2626021 0.0742639 0.0356456 0.0683202
#> 4 0.0114894 0.0386392 0.0554091 0.1187885 0.3976189 0.0579956 0.1261062
#> 5 0.0343655 0.0072476 0.0463921 0.4746251 0.0651319 0.0514096 0.0452111
#> 6 0.0134776 0.1531387 0.1146877 0.2798408 0.0854058 0.0354065 0.0446041
#> 7 0.0893084 0.0598781 0.0407770 0.0055078 0.1314200 0.1213795 0.0752119
#> 8 0.0760796 0.0406151 0.0218903 0.0293232 0.0382301 0.1044732 0.0959325
#> 9 0.1644812 0.1840483 0.0507512 0.0550968 0.0676102 0.1854379 0.0987736
#> 10 0.0142279 0.0149324 0.0298655 0.0199528 0.0993833 0.0047344 0.0955929
#> year
#> quant 8 9 10
#> 1 0.0023086 0.0489219 0.0889172
#> 2 0.0849537 0.2456885 0.0494942
#> 3 0.0144158 0.0390966 0.0764664
#> 4 0.0209226 0.1361284 0.0369019
#> 5 0.0285275 0.2148501 0.0322396
#> 6 0.0702897 0.0685988 0.1345503
#> 7 0.0233273 0.3338459 0.1193441
#> 8 0.2744723 0.1059551 0.2130286
#> 9 0.0260751 0.1106233 0.0571024
#> 10 0.0281396 0.6744582 0.0187129
#>
#> units: NA
# or year
flq / yearTotals(flq)
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6 7
#> 1 0.0482686 0.6298791 0.0148693 0.0461859 0.0259501 0.4569021 0.1033083
#> 2 0.0514455 0.0521457 0.0117366 0.0579128 0.0704769 0.0411694 0.0520543
#> 3 0.1350576 0.0394682 0.3605810 0.1312272 0.0349798 0.0278609 0.0569923
#> 4 0.0733459 0.0694312 0.2121745 0.1855765 0.5855035 0.1417120 0.3288711
#> 5 0.1214002 0.0072068 0.0983053 0.4103167 0.0530733 0.0695146 0.0652462
#> 6 0.0222483 0.0711569 0.1135625 0.1130486 0.0325204 0.0223718 0.0300794
#> 7 0.1419344 0.0267863 0.0388728 0.0021421 0.0481772 0.0738371 0.0488308
#> 8 0.1375499 0.0206695 0.0237399 0.0129740 0.0159435 0.0722988 0.0708549
#> 9 0.1975992 0.0622372 0.0365721 0.0161982 0.0187355 0.0852711 0.0484755
#> 10 0.0711504 0.0210191 0.0895860 0.0244180 0.1146397 0.0090623 0.1952872
#> year
#> quant 8 9 10
#> 1 0.0088042 0.0345196 0.2133771
#> 2 0.1144333 0.0612323 0.0419517
#> 3 0.0237836 0.0119345 0.0793846
#> 4 0.1079141 0.1299083 0.1197671
#> 5 0.0814228 0.1134602 0.0579026
#> 6 0.0937477 0.0169282 0.1129221
#> 7 0.0299533 0.0793145 0.0964290
#> 8 0.4009371 0.0286368 0.1958129
#> 9 0.0253093 0.0198667 0.0348766
#> 10 0.1136946 0.5041989 0.0475761
#>
#> units: NA