Skip to contents

Calculates the percentage of each category (rows) per column (month), and also includes the total number of data per column (N).

For the analysis performed in Salas-Singh et al. (2022), immatures fish may or may not be included in the analysis. If the "immatures" object is assigned zero, they are excluded from the analysis, any non-zero value includes them.

Usage

fn_porcentaje(df, meses, immatures, Phases_legend)

Arguments

df

A data frame array, including the number of data by factor level (rows) and month (column).

meses

A vector of characters representing the initials of the months of the year.

immatures

An integer value defined outside this function.

Phases_legend

A vector with the name or number of the stages of maturity, as specified in the object *Phases*, outside of this function. Legend for phases: 1 roman numeral, 2 names

Value

countsp: A table with the percentage of each category and N.

Examples

  if (FALSE) {
#This is an example ... .
#The immatures are excluded from the analysis, giving them a value of zero.

    df <- tmp
    meses <- c("J","F","M","A","M","J","J","A","S","O","N","D")
    immatures <- 0
    Phases_legend <- c("II", "III", "IV", "V", "VI")
    ejemplo <- fn_porcentaje(df, meses, immatures, Phases_legend)
  }