tapsum | R Documentation |
data exploration commonly uses the tapply function and tapsum simplifies its use when obtaining the sum of any variable relative to other variables. For example it is common to want the total catch by year and, for example, Month, DepCat, Zone, etc.
tapsum(indat, first, second, third = NA, div = 1000)
indat |
the data.frame containing the raw fishery data |
first |
the variable name (in quotes) being summed |
second |
the first grouping variable |
third |
the second grouping variable, defaults to NA |
div |
defaults to 1000 to change Kg to tonnes. set to 1.0 or NA to avoid its influence |
a vector or matrix of sums of the pickvar by the first and optionally the second grouping variable
## Not run:
data(sps)
tapsum(sps,"catch_kg","Year","Month")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.