csAggregate: Splits the fishPi CS object into subsets, computes summary...

Description Usage Arguments Value Author(s) Examples

Description

Splits the fishPi CS object into subsets, computes summary statistics for each, and returns the result in a convenient form.

Usage

1
csAggregate(csObj, x, by, aggFun, ...)

Arguments

csObj

to aggregate.

x

field to aggregate.

by

a list of grouping elements.

aggFun

a function to compute the summary statistic.

...

further arguments passed to or used by aggFun

Value

A data frame with columns corresponding to the grouping variables in by followed by aggregated columns from x.

Author(s)

Norbert Billet - IRD

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
data(sole)
sole.cs.pi <- csDataTocsPi(sole.cs)
aggByFoCatEu5 <- csAggregate(csObj=sole.cs.pi, x=list(lenNum="lenNum"), by=list(foCatEu5="foCatEu5", lenCls="lenCls"), sum, na.rm=TRUE)

library(ggplot2)
ggplot(data=aggByFoCatEu5) + geom_bar(mapping=aes(x=lenCls, y=lenNum), stat="identity") + facet_wrap(~foCatEu5, ncol=1, scales="free_y") + theme_bw()

## End(Not run)

ldbk/fishPifct documentation built on May 20, 2019, 11:28 p.m.