clean_dataset: Clean datasets from Gamebirds for Lincoln estimations

View source: R/prepare_data.R

clean_datasetR Documentation

Clean datasets from Gamebirds for Lincoln estimations

Description

This function takes a dataframe directly exported from Gamebirds and prepares it to be used by the gblincoln package. It performs the following actions in the following order:

  • Rename columns (see rename_columns)

  • Add age classes (see set_age_classes)

  • Add sex classes (see set_sex_classes)

  • Correct recovery years (see correct_recovery_years)

Usage

clean_dataset(
  df,
  rename_columns = TRUE,
  colnames = NULL,
  add_age_classes = TRUE,
  age_classes = NULL,
  add_sex_classes = TRUE,
  sex_classes = NULL,
  correct_recovery_years = TRUE
)

Arguments

df

The dataframe to clean. Must contain untouched data coming from Gamebirds.

rename_columns

Should the columns be renamed? Default: TRUE

colnames

Data frame. The columns to rename. Will be passed as the columns argument to the rename_columns function, Default: NULL

add_age_classes

Should the function add age classes? Default: TRUE

age_classes

The age classes that will be passed as the age_classes argument of the (see set_age_classes) function. Default: NULL

add_sex_classes

Should the function add sex classes? Default: TRUE

sex_classes

The sex classes that will be passed as the sex_classes argument of the (see set_sex_classes) function. Default: NULL

correct_recovery_years

Should the recovery years be corrected? Default: TRUE

Details

  • Adding age classes will only work if the age_code column is present in the dataframe.

  • Adding sex classes will only work if the sex_code column is present in the dataframe.

  • Correcting recovery years will only work if the r.year column is present in the dataframe

Value

The modified dataframe


Vin985/gblincoln documentation built on April 21, 2022, 1:49 a.m.