# Calculate the slope of the community abundance

### Description

Calculates the slope of the community abundance through time by performing a linear regression on the logged total numerical abundance at weight and logged weights (natural logs, not log to base 10, are used). You can specify minimum and maximum weight or length range for the species. Lengths take precedence over weights (i.e. if both min_l and min_w are supplied, only min_l will be used). You can also specify the species to be used in the calculation.

### Arguments

`object` |
An object of class |

`species` |
Numeric or character vector of species to include in the calculation. |

`biomass` |
Boolean. If TRUE (default), the abundance is based on biomass, if FALSE the abundance is based on numbers. |

`min_w` |
Minimum weight of species to be used in the calculation. |

`max_w` |
Maximum weight of species to be used in the calculation. |

`min_l` |
Minimum length of species to be used in the calculation. |

`max_l` |
Maximum length of species to be used in the calculation. |

### Value

A data frame with slope, intercept and R2 values.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## Not run:
data(NS_species_params_gears)
data(inter)
params <- MizerParams(NS_species_params_gears, inter)
sim <- project(params, effort=1, t_max=40, dt = 1, t_save = 1)
# Slope based on biomass, using all species and sizes
slope_biomass <- getCommunitySlope(sim)
# Slope based on numbers, using all species and sizes
slope_numbers <- getCommunitySlope(sim, biomass=FALSE)
# Slope based on biomass, using all species and sizes between 10g and 1000g
slope_biomass <- getCommunitySlope(sim, min_w = 10, max_w = 1000)
# Slope based on biomass, using only demersal species and sizes between 10g and 1000g
dem_species <- c("Dab","Whiting","Sole","Gurnard","Plaice","Haddock", "Cod","Saithe")
slope_biomass <- getCommunitySlope(sim, species = dem_species, min_w = 10, max_w = 1000)
## End(Not run)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.