Description Usage Arguments Value Author(s) Examples
Splits the fishPi CS object into subsets, computes summary statistics for each, and returns the result in a convenient form.
1 | csAggregate(csObj, x, by, aggFun, ...)
|
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 |
A data frame with columns corresponding to the grouping variables in by followed by aggregated columns from x.
Norbert Billet - IRD
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.