Loads trait data and sets species names as row names. If a CSV path is
supplied, it is read with read.csv. By default, all non-species
columns are returned (numeric, factor, integer, etc.). Use
trait_cols to select a subset.
Usage
read_traits(
x,
species_col = "species",
trait_cols = NULL,
factor_cols = NULL,
ordered_cols = NULL
)Arguments
- x
character path to a CSV file, or a
data.frame.- species_col
character. Name of the column containing species names (default
"species").- trait_cols
character vector of column names to include. If
NULL(default), all columns exceptspecies_colare used.- factor_cols
character vector of columns to coerce to
factor.- ordered_cols
character vector of columns to coerce to
ordered.
Examples
df <- data.frame(species = c("Sp_a", "Sp_b"), mass = c(10, 20))
traits <- read_traits(df, species_col = "species")
