get_stage_names: Extract the Developmental Stage Names from the Header

View source: R/lifetable_data.R

get_stage_namesR Documentation

Extract the Developmental Stage Names from the Header

Description

Extracts the names of the developmental stages from the header (first row) of a life table csv file. The header is truncated at the sex column, the ID column is dropped, and the two adult labels before the sex column are replaced by "Female" and "Male".

Usage

get_stage_names(lt)

Arguments

lt

A life_table object returned by lifeTable_read.

Details

Stage names are taken from the header exactly as they are spelled in the csv file, so English headers produce English stage names and Chinese headers produce Chinese stage names. Only the two adult labels are always converted to "Female" and "Male". Internally the sex column is located by matching the header entry gender and the ID column by the header entry ID (both are fixed parts of the csv template).

Value

A character vector of stage names, e.g. c("Egg", "Larva", "Pupa", "Female", "Male"); used as column names by calc_sxj and as legend labels by lifeTable_plot.

See Also

lifeTable_read, calc_sxj, lifeTable_plot

Examples

lt <- lifeTable_read(system.file("extdata", "lifetable_example.csv",
                                  package = "insectecol"))
get_stage_names(lt)

insectecol documentation built on Oct. 5, 2026, 5:08 p.m.