barroso_add_char_template

Append a blank morphological-character template to a species table.
barRoso::barroso_add_char_template()

Description

Given a data.frame of species (one row per species, or per specimen) OR a path to an Excel file containing such data, this function writes an .xlsx file whose columns begin with whatever identification columns are in species_df — Genus/Species/Author, Family/Taxon, etc. — and continue with a standard morphological-character template (HABIT, STIPULE, LEAF, INFLORESCENCE, FLOWER, FRUIT, SEED) left empty for the user to fill in.

When plant_group is specified, INFLORESCENCE/FLOWER/FRUIT blocks are replaced with the morphology that group actually has — e.g. Leguminosae-Papilionoideae swaps generic petals for STANDARD / WING / KEEL and adds stamen arrangement and fruit dehiscence; Asteraceae replaces the inflorescence with capitulum + involucre and the flower block with RAY / DISC florets + pappus; Ochnaceae uses the full carpophore/mericarp fruit and seed-apical-hook block; Orchidaceae uses dorsal/lateral sepals, labellum and column. Supported groups:

  • “Leguminosae-Papilionoideae”
  • “Leguminosae-Caesalpinioideae”
  • “Leguminosae-Mimosoideae”
  • “Asteraceae”
  • “Ochnaceae”
  • “Orchidaceae”

The resulting file is the input format expected by barroso_write_taxon_descr(): column-name conventions match (capitalised group prefixes, lowercase subterms, “(cm)” / “(mm)” / “(m)” units, “length” / “width” / “height” keywords).

Arguments

Argument Description
species_df Either a data.frame containing the species-identification columns you want preserved (e.g. Genus, Species, Author), OR a character string path to an Excel file (.xlsx) containing such data. Every column in species_df is copied into the output as-is; template columns are appended after them and written empty. Any template column whose name already exists in species_df is skipped, so user data is never overwritten.
sheet Character string or integer. Sheet name or index to read when species_df is a path to an Excel file. Default is 1.
plant_group Optional character. One of the supported profiles listed above. NULL (default) uses the generic flowering-plant profile.
species_cols Character vector or integer indices. Column names or indices used to build the species header (e.g., c(“Genus”, “Species”, “Author”) or 1:3). These can be combined flexibly (e.g., a single “Scientific_name” column or separate Genus, Species, and Author columns).
overwrite Logical. If TRUE (default), an existing file at the target path is overwritten; if FALSE, the function errors out.
format_excel Logical. If TRUE (default), the function will use more user-friendly format for the spreadsheet.
sheet_name Character. Name of the worksheet. Default “described_specimens”.
base_font_size Numeric. Base font size. Default 10.
base_font_name Character. Base font name. Default “Calibri Light”.
verbose Logical. Print progress messages. Default TRUE.
filename Output file base name (with or without “.xlsx”). If NULL, uses “taxon_template” or “_template” when a group is given.
dir Output directory. If NULL, a directory named after filename (without extension) is created in the working directory. A date-stamped subfolder is created inside.

Value

Invisibly returns the absolute path to the written .xlsx file.

Examples

# Using a data frame
species_df <- data.frame(
  Genus   = c("Ouratea", "Ouratea", "Ouratea"),
  Species = c("acicularis", "acuminata", "cassinefolia"),
  Author  = c("R.G.Chacon & K.Yamam.", "(DC.) Engl.", "(DC.) Engl.")
)

barroso_add_char_template(
  species_df = species_df,
  filename   = "Ouratea_template"
)

# Using an Excel file path
barroso_add_char_template(
  species_df = "my_species_list.xlsx",
  sheet = 1,
  plant_group = "Ochnaceae",
  filename = "Ouratea_Ochnaceae_template"
)