Skip to contents

Using a tidy dataframe containing the number of live animals, this function restricts the species of animals to: Asses, Camels, Cattle, Horses, Mules, Buffaloes, and Camelids, other; then combines Camels and Camelids, other into a combined "Camelids" species group.

Usage

get_working_species(
  .df,
  species = MWTools::mw_constants$species,
  country_code_col = MWTools::conc_cols$country_code_col,
  amw_region_code_col = MWTools::conc_cols$amw_region_code_col,
  year = MWTools::mw_cols$year,
  value = MWTools::mw_constants$value,
  asses = MWTools::mw_species$asses,
  camels = MWTools::mw_species$camels,
  cattle = MWTools::mw_species$cattle,
  horses = MWTools::mw_species$horses,
  mules = MWTools::mw_species$mules,
  buffaloes = MWTools::mw_species$buffaloes,
  camelids_other = MWTools::mw_species$camelids_other,
  camelids = MWTools::mw_species$camelids,
  live_animals_col = MWTools::amw_analysis_constants$live_animals_col
)

Arguments

.df

A tidy data frame containing the number of live animals by country over time. Usually produced by calling the tidy_fao_live_animals, add_concordance_codes, and trim_fao_data functions in sequence on the raw FAO data.

species, value, year

See MWTools::mw_constants.

country_code_col, amw_region_code_col

See MWtools::conc_cols.

asses, camels, cattle, horses, mules, buffaloes, camelids_other, camelids

See MWTools::mw_species.

live_animals_col

See MWtools::amw_analysis_constants.

Examples

live_animals_data <- read.csv(file = MWTools::amw_test_data_path()) %>%
  tidy_fao_live_animals() %>%
  add_concordance_codes() %>%
  trim_fao_data() %>%
  get_working_species()