---
title: "BioIndex"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{BioIndex}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

# Description

**BioIndex** supports the standardized analysis of MEDITS trawl survey data and the calculation of biological indicators for selected species and population components. The package provides functions to estimate abundance and biomass indices, analyse size structure and length frequency distributions, derive sex ratio and maturity related metrics, explore spatial patterns, and assess temporal trends across surveys. 

Developed for integration within the RDBFIS framework, it is intended to work on quality checked input data (via the **RoME** package) and to produce reproducible outputs that can support monitoring, comparative analyses among GSAs and countries, and fishery management.

The package allows to perform the analysis at GSA level or country level, estimating the time series and the spatial distribution of a wide pool of population state-indicators. It also offers statistical trend analysis of both abundance and biomass time series based on the Hotelling-Pabst test (Cotter, 2009) and spatial analysis using the 0.5*0.5° GFCM grid or bubble plots.

# Installation

Install the latest BioIndex release from CRAN (when available):

```r
install.packages("BioIndex")
```

# Use

The main function `BioIndex()` can be used to launch a complete analysis:

```{r, eval=FALSE, fig.height=8, fig.width=8}
BioIndex::BioIndex(ta=BioIndex::TA, tb=BioIndex::TB, tc=BioIndex::TC, 
                   sspp="MERLMER",rec_threshold=200,
                   spaw_threshold=210,sexes="all", depth=c(10,800), GSA=10,
                   country="all", map_lim=c(13.3,15.2,39.9,41.3),
                   depth_lines=c(50,200,800), strata=BioIndex::strata_scheme,
                   stratification_tab = BioIndex::stratification, resolution=1,
                   buffer=0.1, wd=tempdir(), zip=FALSE, save=FALSE, verbose=TRUE)
```
