names_to: Assign names based on taxo hierarchy

View source: R/gen_rename.R

names_toR Documentation

Assign names based on taxo hierarchy

Description

This allows you to use the taxo hierarch to move up to a more broad name

Usage

names_to(df, new_names, suppress_print = F)

Arguments

df

an ecotaxa tsv-style dataframe

new_names

a vector of character names to move towards default

suppress_print

set to true to stop messages of matches

Author(s)

Alex Barth

Examples

# Re-classifying to a broader group:
Copepod_obj <- ecopart_example |> 
  add_zoo(func = names_to, col_name = 'name',
          new_names = c('living', 'not-living', 'Copepoda'),
          suppress_print  = TRUE)

#working with a single zoo_df will return name vector
cast1_copes <- ecopart_example$zoo_files$bats361_ctd1 |> 
  names_to(new_names = c('living', 'not-living', 'Copepoda'))
# how many copepods in cast 1?
cast1_copes |> table()

TheAlexBarth/EcotaxaTools documentation built on Nov. 14, 2024, 8:27 p.m.