plot_growth {ggFishPlots} | R Documentation |
Plot age-length relationships and growth curves
Description
Plot age-length relationships and growth curves
Usage
plot_growth(
dt,
length = "length",
age = "age",
sex = "sex",
female.sex = "F",
male.sex = "M",
length.unit = "cm",
split.by.sex = FALSE,
growth.model = 1,
force.zero.group.length = NA,
force.zero.group.strength = 10,
force.zero.group.cv = 0,
show.Linf = TRUE,
boxplot = TRUE,
base_size = 8,
legend.position = "bottom"
)
Arguments
dt |
A data.frame, tibble or data.table |
length |
Character argument giving the name of the length column in |
age |
Character argument giving the name of the age column in |
sex |
Character argument giving the name of the sex column in |
female.sex , male.sex |
A character or integer denoting female and male sex in the |
length.unit |
A character argument giving the unit of |
split.by.sex |
Logical indicating whether the result should be split by sex. |
growth.model |
Integer defining the growth model. 1 = von Bertalanffy, 2 = Gompertz, 3 = Logistic. |
force.zero.group.length |
Numeric indicating the length to which 0-group should be forced. Use |
force.zero.group.strength |
Numeric indicating how many percent of total fish should be added to the specified |
force.zero.group.cv |
Numeric indicating the coefficient of variation for the forced 0-group length. Resulting lengths will be randomly generated from a normal distribution. |
show.Linf |
Logical indicating whether Linf values should be shown as dashed vertical lines. |
boxplot |
Logical indicating whether boxplots ( |
base_size |
Base size parameter for ggplot. See ggtheme. |
legend.position |
Position of the ggplot legend as a character. See ggtheme. |
Details
Uses the fishmethods::growth
function to calculate the growth curves. Zero group length can be forced to the growth functions using the force.zero.group.*
parameters.
Value
A list containing the plot
, text
for Rmarkdown and Shiny applications, and estimated parameters (params
).
Author(s)
Mikko Vihtakari // Institute of Marine Research.
Examples
# Simple plot. Note that a list is returned.
data(survey_ghl)
plot_growth(survey_ghl, length = "length", age = "age")
# Split by sex
plot_growth(survey_ghl, split.by.sex = TRUE)$plot
# Data as points. Forcing zero group to 10 cm
plot_growth(survey_ghl, force.zero.group.length = 10, boxplot = FALSE)$plot