[FLR-list] bug in areaSums

Clara Ulrich clu at aqua.dtu.dk
Sat Feb 25 23:50:44 CET 2012


Hi, 

I found a bug in the basic method areaSums, which sum applies only on dim 1:4 instead of c(1:4,6). 

flq <- FLQuant(rnorm(4000), dim=c(5,10,2,2,2,10), quant='age')
>  dim(quantSums(flq))
[1]  1 10  2  2  2 10
>  dim(areaSums(flq))
[1]  5 10  2  2  1  1
>  dim(yearSums(flq))
[1]  5  1  2  2  2 10
>  dim(unitSums(flq))
[1]  5 10  1  2  2 10
>  dim(seasonSums(flq))
[1]  5 10  2  1  2 10
>  dim(areaSums(flq))
[1]  5 10  2  2  1  1

> selectMethod("areaSums",signature="FLQuant")
Method Definition:
function (x, ...) 
{
    .local <- function (x, na.rm = TRUE) 
    {
        return(apply(x, c(1:4), sum, na.rm = na.rm))
    }
    .local(x, ...)
}
<environment: namespace:FLCore>
Signatures:
        x        
target  "FLQuant"
defined "FLQuant"


areaVars and areaMeans are correct. 

Cheers
Clara


More information about the flr-list mailing list