Skip to contents

histyear plots a histogram of a given variable for each year available

Usage

histyear(
  x,
  xlimit = c(NA, NA, NA),
  pickvar = "cpue",
  years = "year",
  varlabel = "CPUE",
  vline = NA,
  plots = c(5, 5),
  normadd = TRUE,
  left = TRUE
)

Arguments

x

the data.frame of data with at least a 'Year' and pickvar present

xlimit

the xaxis bounds for all histograms, defaults to c(NA,NA,NA), the values would be as used in seq(xlimit[1],xlimit[2],xlimit[3]). If the default is used then the 0 and 0.98 quantiles of the variable are used as the bounds with 25 bins

pickvar

which variable to plot each year default = 'cpue'

years

which variable name identifies the yaer column, default='year'

varlabel

what label to use on x-axis, default = 'CPUE'

vline

an optional vertical line to aid interpretation. If it is numeric it will be added to each plot

plots

how many plots to generate, default = c(5,5)

normadd

should a normal distribution be added to each plot. default=TRUE

left

on which side of each plot should the year and number of records be placed left=TRUE is the default. left=FALSE will place text on right

Value

invisibly, a matrix of the year, mean value, stdev, and N number of observations. It also plots a histogram for each year and fits a normal distribution to each one.

Examples

if (FALSE) {
print("still to be developed")
# pickvar="x100nethr";years="year";varlabel="log(CPUE)";vline=NA;plots=plotnum;
# normadd=TRUE;left=FALSE;xlimit=c(0,250,10)
}