siteplot | R Documentation |
Generate boxplot of captures for all sites, by year or species, with those from one site highlighted.
siteplot(data, site=0, year=0, visit=FALSE, splist=NULL, nspecies=20, nyears=NA, age=0, subset=NULL, effort=FALSE, ylab=NULL, margin=8, pch=21, pt.cex=2, pt.col='red', plot=TRUE, ...)
data |
either a dataframe generated by |
site |
character, the site to highlight |
year |
integer, specify a year to create a summary by species or visit |
visit |
logical, summarise catches within a year by visit number? If visit=FALSE (the default), catches will be summarised by species |
splist |
character, if a year is specified, optionally either a vector of Euring codes, or 'all' (not generally advised) |
nspecies |
numeric, if a year is specified and splist not, then plot the commonest 'n' species on the site |
nyears |
numeric, limit the number of years plotted to the number that the site operated, with this as a minimum. For example, if nyears=10 and the site has operated for 15 years, 15 bars (and dots) will be shown, but if the site has only operated for 5 years, then 10 bars will be plotted. |
age |
numeric, either 3 or 4 to select only juvenile or adult captures |
subset |
a logical expression to subset the data |
effort |
logical, should the number of captures be divided by netlength on the site? |
ylab |
character, a label for the number axis |
margin |
if year is specified, either a single number for the width of the left margin, or a vector of length 4 specifying each margin width, see details |
pch |
the symbol with which the site counts are plotted |
pt.cex |
size of the symbol with which the site counts are plotted |
pt.col |
colour of the symbol with which the site counts are plotted |
plot |
logical, should a plot be produced. For larger datasets, creating the summary data first without plotting may be helpful, see details |
... |
additional arguments passed to |
Generates a boxplot of captures per site, with those from 'site' highlighted using an overlain point. Data may be summarised either annually (if year=0), or by species (if a year is specified). In the former case the boxes will be vertical, in the latter horizontal. The width of the margin(s) can be changed (by using margin=) if there is not enough room for the species names.
For larger datasets, creating the boxplot summaries may take some time. In this case it is advised to run the function with plot=FALSE to create the data for the boxplot. This can then be supplied to data=, meaning that only the individual site counts need to be extracted and plotted each time.
A list with three components:
ds |
the (subsetted) dataset |
ds.bxp |
data for the boxplot in summary form |
ds.attr |
some useful attributes |
It is assumed that this function will be used for current sites, so the nyears argument only counts backwards from the current year.
Rob Robinson
data(ukdata)
uk.bxp <- siteplot(ukdata, site='656')
siteplot(uk.bxp, site='420')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.