Summaries by dimension
Source:R/genericMethods.R
, R/FLQuant.R
, R/FLQuantDistr.R
, and 1 more
dimSummaries.Rd
Methods to compute various summary calculations (sum, mean, variance) over
selected dimensions of objects from any array-based classes
(e.g. FLQuant
). These methods return an object of the
same dimensions as the input but with length one in the dimension chosen
to operate along.
Usage
quantSums(x, ...)
yearSums(x, ...)
unitSums(x, ...)
seasonSums(x, ...)
areaSums(x, ...)
iterSums(x, ...)
dimSums(x, ...)
quantMeans(x, ...)
yearMedians(x, ...)
yearMeans(x, ...)
unitMeans(x, ...)
seasonMeans(x, ...)
areaMeans(x, ...)
iterMeans(x, ...)
dimMeans(x, ...)
quantVars(x, ...)
yearVars(x, ...)
unitVars(x, ...)
seasonVars(x, ...)
areaVars(x, ...)
iterVars(x, ...)
dimVars(x, ...)
iterMedians(x, ...)
iterCVs(x, ...)
iterProb(x, ...)
# S4 method for class 'FLQuant'
quantSums(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
yearSums(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
unitSums(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
seasonSums(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
areaSums(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
iterSums(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
quantMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
yearMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
unitMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
seasonMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
areaMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
iterMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
yearMedians(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
iterMedians(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
quantVars(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
yearVars(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
unitVars(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
seasonVars(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
areaVars(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
iterVars(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
iterCVs(x, na.rm = TRUE)
# S4 method for class 'FLQuant'
iterProb(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
yearSums(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
unitSums(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
seasonSums(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
areaSums(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
yearMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
unitMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
seasonMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
areaMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
iterMeans(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
iterMedians(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
quantVars(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
yearVars(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
unitVars(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
seasonVars(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
areaVars(x, na.rm = TRUE)
# S4 method for class 'FLQuantDistr'
iterVars(x, na.rm = TRUE)
# S4 method for class 'FLPar'
iterMeans(x, na.rm = TRUE)
# S4 method for class 'FLPar'
iterMedians(x, na.rm = TRUE)
# S4 method for class 'FLPar'
iterVars(x, na.rm = TRUE)
# S4 method for class 'FLPar'
iterSums(x, na.rm = TRUE)
Details
This set of methods computes three different summaries (sum, mean and
variance) of an FLQuant
object along each of the six dimensions
(quant, year, unit, season, area, or iter). Medians and CVs can also be
computed along the sixth dimension, iter
.
These methods encapsulate a call to apply
with
the corresponding dimensions and function: mean
,
median
, var
, and
sum
, while iterCVs
are computed as
sqrt(iterVars) / iterMeans
.
In contrast with R standard behaviour, the sum of a dimension where all
elements are NA
will be NA
and not 0. See example below.
Methods working along the iter dimension are also defined for objects of class
FLPar
.
Methods to operate over the first dimension refer to it as the quant
dimension, regardless of the actual name used in the object.
Generic methods
quantSums(x), quantMeans(x), quantVars(x) yearSums(x), yearMeans(x), yearVars(x) unitSums(x), unitMeans(x), unitVars(x) seasonSums(x), seasonMeans(x), seasonVars(x) areaSums(x), areaMeans(x), areaVars(x) iterMeans(x), iterVars(x), iterMedians(x), iterSums(x) dimSums(x), dimMeans(x), dimVars(x)
Examples
flq <- FLQuant(rnorm(4000), dim=c(5,10,2,2,2,10), quant='age')
quantSums(flq)
#> An x of class "FLQuant"
#> iters: 10
#>
#> , , unit = 1, season = 1, area = 1
#>
#> year
#> age 1 2 3 4
#> all -1.4767(2.606) -0.3329(2.154) -0.9374(2.784) -0.6807(2.203)
#> year
#> age 5 6 7 8
#> all -0.4033(2.466) -0.8618(1.673) -0.0331(3.440) -0.0672(1.501)
#> year
#> age 9 10
#> all 1.2103(2.962) -0.8277(4.459)
#>
#> , , unit = 2, season = 1, area = 1
#>
#> year
#> age 1 2 3 4
#> all -0.0235(1.951) 0.9471(1.837) 1.1820(3.496) -0.0846(1.860)
#> year
#> age 5 6 7 8
#> all -0.2482(1.272) -0.7908(1.542) 1.0608(1.878) 1.0310(1.422)
#> year
#> age 9 10
#> all 0.6958(1.449) 1.1391(2.218)
#>
#> , , unit = 1, season = 2, area = 1
#>
#> year
#> age 1 2 3 4
#> all 0.3727(1.176) 0.6104(1.728) -0.3811(0.886) 0.6575(3.222)
#> year
#> age 5 6 7 8
#> all -0.4183(1.998) 0.3417(1.039) -0.9089(3.436) 0.5986(2.562)
#> year
#> age 9 10
#> all -1.0804(2.737) 0.3106(1.415)
#>
#> , , unit = 2, season = 2, area = 1
#>
#> year
#> age 1 2 3 4
#> all 0.8083(0.811) 0.9205(1.725) -0.8311(1.383) 2.1571(1.522)
#> year
#> age 5 6 7 8
#> all 0.9498(2.472) 0.7816(2.603) 0.2246(1.573) 0.4962(1.928)
#> year
#> age 9 10
#> all 0.8259(2.646) -0.2384(1.411)
#>
#> , , unit = 1, season = 1, area = 2
#>
#> year
#> age 1 2 3 4
#> all -0.3817(2.909) -0.0957(3.093) -0.2931(1.217) 0.0205(2.273)
#> year
#> age 5 6 7 8
#> all 0.0927(1.779) -1.1245(2.149) -0.8267(2.574) -0.0247(2.391)
#> year
#> age 9 10
#> all -0.8659(1.438) -0.6824(1.648)
#>
#> , , unit = 2, season = 1, area = 2
#>
#> year
#> age 1 2 3 4
#> all 0.2073(1.704) -1.6467(1.761) -0.5350(2.752) 1.3545(1.630)
#> year
#> age 5 6 7 8
#> all -0.6224(2.338) 1.2369(0.956) 0.3869(2.099) 0.0426(0.881)
#> year
#> age 9 10
#> all 0.2982(2.369) 0.0639(1.290)
#>
#> , , unit = 1, season = 2, area = 2
#>
#> year
#> age 1 2 3 4
#> all 0.1875(2.581) 1.1672(2.387) -0.0203(2.802) -0.4156(1.964)
#> year
#> age 5 6 7 8
#> all -0.3013(2.128) 1.0541(1.602) -0.5233(1.268) 1.2673(1.877)
#> year
#> age 9 10
#> all 1.3338(3.389) -0.5086(1.669)
#>
#> , , unit = 2, season = 2, area = 2
#>
#> year
#> age 1 2 3 4
#> all -0.1292(1.939) -0.7137(3.618) -0.2447(2.467) -0.2014(3.050)
#> year
#> age 5 6 7 8
#> all -0.9743(1.280) -0.0739(1.860) -1.2235(1.422) -0.8700(1.411)
#> year
#> age 9 10
#> all 0.2705(2.377) -0.2500(4.086)
#>
#> units: NA
quantMeans(flq)
#> An x of class "FLQuant"
#> iters: 10
#>
#> , , unit = 1, season = 1, area = 1
#>
#> year
#> age 1 2 3 4
#> all -0.29534(0.521) -0.06657(0.431) -0.18747(0.557) -0.13614(0.441)
#> year
#> age 5 6 7 8
#> all -0.08066(0.493) -0.17236(0.335) -0.00662(0.688) -0.01344(0.300)
#> year
#> age 9 10
#> all 0.24206(0.592) -0.16553(0.892)
#>
#> , , unit = 2, season = 1, area = 1
#>
#> year
#> age 1 2 3 4
#> all -0.00470(0.390) 0.18941(0.367) 0.23640(0.699) -0.01691(0.372)
#> year
#> age 5 6 7 8
#> all -0.04964(0.254) -0.15815(0.308) 0.21215(0.376) 0.20620(0.284)
#> year
#> age 9 10
#> all 0.13916(0.290) 0.22782(0.444)
#>
#> , , unit = 1, season = 2, area = 1
#>
#> year
#> age 1 2 3 4
#> all 0.07453(0.235) 0.12208(0.346) -0.07623(0.177) 0.13150(0.644)
#> year
#> age 5 6 7 8
#> all -0.08367(0.400) 0.06833(0.208) -0.18179(0.687) 0.11972(0.512)
#> year
#> age 9 10
#> all -0.21607(0.547) 0.06211(0.283)
#>
#> , , unit = 2, season = 2, area = 1
#>
#> year
#> age 1 2 3 4
#> all 0.16166(0.162) 0.18411(0.345) -0.16621(0.277) 0.43142(0.304)
#> year
#> age 5 6 7 8
#> all 0.18996(0.494) 0.15631(0.521) 0.04493(0.315) 0.09925(0.386)
#> year
#> age 9 10
#> all 0.16517(0.529) -0.04769(0.282)
#>
#> , , unit = 1, season = 1, area = 2
#>
#> year
#> age 1 2 3 4
#> all -0.07634(0.582) -0.01914(0.619) -0.05861(0.243) 0.00409(0.455)
#> year
#> age 5 6 7 8
#> all 0.01854(0.356) -0.22490(0.430) -0.16534(0.515) -0.00493(0.478)
#> year
#> age 9 10
#> all -0.17319(0.288) -0.13647(0.330)
#>
#> , , unit = 2, season = 1, area = 2
#>
#> year
#> age 1 2 3 4
#> all 0.04147(0.341) -0.32934(0.352) -0.10699(0.550) 0.27090(0.326)
#> year
#> age 5 6 7 8
#> all -0.12448(0.468) 0.24738(0.191) 0.07739(0.420) 0.00852(0.176)
#> year
#> age 9 10
#> all 0.05965(0.474) 0.01278(0.258)
#>
#> , , unit = 1, season = 2, area = 2
#>
#> year
#> age 1 2 3 4
#> all 0.03750(0.516) 0.23343(0.477) -0.00405(0.560) -0.08311(0.393)
#> year
#> age 5 6 7 8
#> all -0.06026(0.426) 0.21083(0.320) -0.10466(0.254) 0.25345(0.375)
#> year
#> age 9 10
#> all 0.26675(0.678) -0.10172(0.334)
#>
#> , , unit = 2, season = 2, area = 2
#>
#> year
#> age 1 2 3 4
#> all -0.02585(0.388) -0.14274(0.724) -0.04895(0.493) -0.04028(0.610)
#> year
#> age 5 6 7 8
#> all -0.19486(0.256) -0.01479(0.372) -0.24470(0.284) -0.17401(0.282)
#> year
#> age 9 10
#> all 0.05410(0.475) -0.05001(0.817)
#>
#> units: NA
yearSums(flq)
#> An x of class "FLQuant"
#> iters: 10
#>
#> , , unit = 1, season = 1, area = 1
#>
#> year
#> age 1
#> 1 -0.4530(2.683)
#> 2 -0.8587(2.835)
#> 3 1.2621(2.858)
#> 4 -0.5177(2.899)
#> 5 -2.5742(2.545)
#>
#> , , unit = 2, season = 1, area = 1
#>
#> year
#> age 1
#> 1 1.9759(2.332)
#> 2 -0.0409(1.468)
#> 3 1.3297(2.791)
#> 4 1.2954(3.968)
#> 5 0.2344(4.839)
#>
#> , , unit = 1, season = 2, area = 1
#>
#> year
#> age 1
#> 1 0.5242(2.618)
#> 2 0.3439(2.979)
#> 3 -1.1801(4.172)
#> 4 2.1721(1.202)
#> 5 0.3156(2.183)
#>
#> , , unit = 2, season = 2, area = 1
#>
#> year
#> age 1
#> 1 0.7304(5.109)
#> 2 1.6524(2.416)
#> 3 1.7044(2.837)
#> 4 -0.4293(1.851)
#> 5 1.2397(4.828)
#>
#> , , unit = 1, season = 1, area = 2
#>
#> year
#> age 1
#> 1 -0.7456(1.851)
#> 2 -1.8930(0.537)
#> 3 -1.6961(1.973)
#> 4 -0.7701(2.490)
#> 5 -0.0653(2.513)
#>
#> , , unit = 2, season = 1, area = 2
#>
#> year
#> age 1
#> 1 -0.2412(2.239)
#> 2 -1.4507(2.886)
#> 3 1.5350(2.570)
#> 4 0.5724(3.687)
#> 5 0.8400(3.356)
#>
#> , , unit = 1, season = 2, area = 2
#>
#> year
#> age 1
#> 1 -0.4864(3.589)
#> 2 -0.3035(2.371)
#> 3 0.0585(2.619)
#> 4 0.2089(0.725)
#> 5 3.6885(2.013)
#>
#> , , unit = 2, season = 2, area = 2
#>
#> year
#> age 1
#> 1 1.1739(5.532)
#> 2 -0.7424(4.742)
#> 3 -2.5139(4.532)
#> 4 -0.8231(2.642)
#> 5 -0.3931(1.958)
#>
#> units: NA
iterMeans(flq)
#> An x of class "FLQuant"
#> , , unit = 1, season = 1, area = 1
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 -2.56e-02 -3.14e-01 3.58e-01 -2.88e-01 -6.01e-02 2.37e-01 7.23e-02
#> 2 3.05e-02 4.89e-03 1.13e-01 1.99e-02 -8.93e-02 -2.72e-01 -1.17e-02
#> 3 -2.86e-01 -3.78e-01 -3.30e-01 1.20e-01 1.21e-02 1.19e-01 2.47e-01
#> 4 -4.93e-01 2.85e-01 -6.44e-01 4.41e-01 -1.92e-01 -4.91e-01 2.70e-01
#> 5 -3.71e-01 4.27e-02 -1.52e-01 -8.57e-01 -4.27e-01 -3.41e-01 -5.51e-01
#> year
#> age 8 9 10
#> 1 1.12e-05 2.08e-01 -1.57e-02
#> 2 -6.45e-01 6.32e-01 -5.92e-01
#> 3 1.64e-01 3.76e-01 3.66e-01
#> 4 3.40e-01 1.32e-01 -2.71e-01
#> 5 -1.41e-01 -3.59e-02 -3.83e-01
#>
#> , , unit = 2, season = 1, area = 1
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 3.60e-02 1.47e-01 1.51e-01 -6.42e-02 7.16e-01 1.42e-01 7.72e-02
#> 2 4.02e-01 -5.46e-01 2.71e-01 2.26e-01 6.79e-02 -3.03e-01 7.10e-01
#> 3 -5.70e-02 1.23e-01 -7.27e-01 -2.51e-01 6.33e-01 4.43e-02 2.86e-01
#> 4 -1.87e-01 3.58e-01 2.15e-01 1.40e-01 8.81e-02 2.13e-01 -1.57e-01
#> 5 -1.33e-01 4.52e-01 3.46e-01 1.72e-01 -6.07e-01 -2.46e-01 2.08e-01
#> year
#> age 8 9 10
#> 1 4.23e-01 -3.02e-01 1.89e-01
#> 2 3.12e-02 -2.83e-01 -5.24e-02
#> 3 8.47e-02 5.26e-01 3.01e-01
#> 4 6.41e-01 -4.22e-01 3.14e-01
#> 5 3.39e-01 -4.80e-01 -3.06e-01
#>
#> , , unit = 1, season = 2, area = 1
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 9.51e-02 -4.40e-01 -2.31e-01 3.32e-01 5.89e-01 1.37e-01 2.64e-01
#> 2 -4.60e-02 -1.37e-01 4.44e-01 9.37e-02 -5.96e-01 2.36e-01 3.81e-02
#> 3 -1.60e-01 -1.02e-01 -3.68e-01 1.09e-01 6.04e-02 1.10e-01 -3.44e-01
#> 4 8.62e-02 4.55e-01 -2.43e-01 5.58e-01 2.87e-02 -3.26e-02 5.03e-02
#> 5 2.77e-02 3.83e-01 -2.69e-01 -3.24e-01 -6.84e-01 9.47e-02 6.03e-01
#> year
#> age 8 9 10
#> 1 -2.10e-03 8.09e-02 4.87e-01
#> 2 2.47e-01 -9.55e-02 -3.43e-01
#> 3 2.55e-01 -8.45e-02 -7.10e-01
#> 4 3.41e-01 2.63e-02 2.66e-01
#> 5 6.06e-01 -1.79e-01 2.37e-01
#>
#> , , unit = 2, season = 2, area = 1
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 2.24e-01 3.68e-01 3.60e-01 3.02e-01 3.01e-01 -1.19e-01 -1.75e-01
#> 2 -1.06e-01 1.97e-01 -2.01e-01 3.27e-01 1.17e-01 4.84e-01 -1.74e-01
#> 3 6.33e-02 -5.73e-01 -2.40e-01 5.61e-01 6.25e-01 4.29e-01 2.68e-01
#> 4 -7.47e-02 1.44e-01 4.20e-01 -1.18e-01 1.72e-01 5.03e-02 3.75e-01
#> 5 3.03e-01 4.55e-01 -7.14e-03 1.53e-01 -2.67e-02 2.30e-01 -4.02e-02
#> year
#> age 8 9 10
#> 1 -1.31e-02 1.88e-01 -4.30e-01
#> 2 1.59e-01 8.01e-01 -8.35e-02
#> 3 4.22e-01 -3.00e-01 3.54e-02
#> 4 -9.04e-03 1.86e-01 -4.92e-01
#> 5 3.21e-01 -1.99e-01 5.89e-02
#>
#> , , unit = 1, season = 1, area = 2
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 -1.02e-01 3.50e-02 -6.02e-01 -7.16e-02 -3.78e-01 -3.01e-02 4.46e-01
#> 2 -2.67e-01 1.98e-01 2.25e-02 5.84e-02 -2.73e-01 -7.57e-01 1.91e-01
#> 3 1.62e-01 2.66e-01 -1.17e-01 -2.15e-01 1.05e-01 5.56e-02 -7.10e-01
#> 4 2.43e-01 -6.37e-01 -3.80e-01 5.33e-01 3.14e-01 -3.22e-01 1.40e-01
#> 5 1.70e-01 -1.60e-01 3.52e-01 6.46e-02 -3.78e-03 9.20e-02 -1.98e-01
#> year
#> age 8 9 10
#> 1 4.93e-01 -7.48e-02 -3.95e-01
#> 2 -4.26e-01 -3.98e-01 -2.96e-01
#> 3 2.68e-01 1.43e-01 -8.76e-01
#> 4 6.93e-03 -1.65e-01 5.17e-02
#> 5 -3.63e-02 -4.31e-01 -8.21e-03
#>
#> , , unit = 2, season = 1, area = 2
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 -2.99e-01 -4.58e-01 -2.37e-01 1.50e-01 3.33e-01 2.01e-02 2.36e-01
#> 2 3.49e-01 -3.90e-01 2.72e-01 -5.59e-01 -3.28e-01 -3.64e-03 1.54e-01
#> 3 1.90e-01 -3.32e-01 -9.27e-02 5.89e-01 -7.70e-02 2.92e-01 7.71e-02
#> 4 1.54e-01 -4.30e-02 -7.35e-01 7.02e-03 -2.26e-01 1.48e-01 1.36e-01
#> 5 -6.22e-01 5.81e-02 -2.96e-01 9.70e-01 1.00e-01 4.77e-01 2.73e-01
#> year
#> age 8 9 10
#> 1 -1.15e-01 6.53e-03 5.55e-02
#> 2 4.75e-02 -5.88e-03 -3.30e-01
#> 3 2.92e-01 -2.49e-02 -1.69e-01
#> 4 3.36e-01 2.35e-01 3.91e-01
#> 5 -5.73e-01 1.00e-01 1.36e-01
#>
#> , , unit = 1, season = 2, area = 2
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 -2.13e-01 7.18e-01 -2.63e-01 -5.29e-01 -2.01e-01 4.23e-01 -5.21e-01
#> 2 2.67e-02 -6.60e-02 -1.09e-01 8.23e-02 -3.12e-01 1.70e-01 2.16e-01
#> 3 8.33e-02 -9.19e-02 -6.31e-02 1.70e-01 -1.56e-01 -2.80e-01 4.73e-02
#> 4 1.61e-01 2.78e-01 1.14e-01 -1.19e-01 2.05e-01 4.96e-01 -3.24e-01
#> 5 2.72e-01 1.10e-01 -2.20e-03 3.54e-01 2.94e-01 3.91e-02 2.35e-01
#> year
#> age 8 9 10
#> 1 1.53e-01 4.70e-01 -3.20e-01
#> 2 -1.59e-01 -3.65e-01 -4.70e-01
#> 3 2.03e-01 -1.44e-01 2.41e-01
#> 4 4.77e-01 -9.30e-02 9.06e-02
#> 5 1.81e-01 2.03e-01 2.71e-01
#>
#> , , unit = 2, season = 2, area = 2
#>
#> year
#> age 1 2 3 4 5 6 7
#> 1 2.87e-01 2.57e-02 -1.05e-01 1.18e-01 -4.47e-01 4.08e-01 -1.27e-02
#> 2 -4.37e-01 -1.50e-01 2.33e-01 -1.62e-01 -1.17e-01 4.81e-01 -3.30e-01
#> 3 -2.95e-01 -3.96e-01 1.00e-01 1.23e-01 -5.45e-01 -3.63e-01 -2.23e-01
#> 4 2.64e-01 -4.14e-02 -2.08e-01 -2.90e-01 -4.54e-02 -4.93e-01 -2.68e-01
#> 5 8.17e-02 -1.22e-04 -4.54e-02 -2.14e-01 5.56e-02 1.62e-01 -3.50e-01
#> year
#> age 8 9 10
#> 1 -2.23e-01 1.43e-01 -2.10e-01
#> 2 -1.50e-01 4.28e-02 4.87e-01
#> 3 -2.61e-01 -1.75e-01 -5.15e-01
#> 4 -2.41e-02 8.06e-02 -6.66e-02
#> 5 -1.59e-01 5.61e-02 3.91e-02
#>
#> units: NA
dim(quantSums(flq))
#> [1] 1 10 2 2 2 10
# NA dims stay as NA when summed along
x <- FLQuant(c(NA, NA, NA, rnorm(6)), dim=c(3, 3))
quantSums(x)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3
#> all NA 0.401 0.476
#>
#> units: NA
# although in fact a sum of no elements (as na.rm=TRUE) is zero
apply(x, 2:6, sum, na.rm=TRUE)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> quant 1 2 3
#> all 0.000 0.401 0.476
#>
#> units: NA