completePhyloData: Return complete data for phylogeny and tabular data

View source: R/completePhyloData.R

completePhyloDataR Documentation

Return complete data for phylogeny and tabular data

Description

Return observations present in a data set and also in a phylogeny. Taxon name (e.g., species names) need to be present in the data frame provided. The data frame can contain multiple observations per taxon.

Usage

completePhyloData(
  phylogeny = NULL,
  dataset = NULL,
  traits = NULL,
  taxon_name = "animal"
)

Arguments

phylogeny

(phylo). Phylogeny with tip labels naming terminal taxa.

dataset

(dataframe). Data frame with a column representing the terminal taxon names equivalent to tip labels in phylogeny (e.g., species names if working at the species level)

traits

(character). Name of the variables of interest. Complete data for these columns will be returned. It is important that the traits specified match column names in the dataset.

Value

List containing a phylogeny and a data frame including the variables of interest with observations for these variables and also present in the phylogeny.

Examples

## Not run: 
# Get phylogenetic and traits complete data for an example obtained simulating data

# Simulate example data
simulated_traits.data <- simulateDataSet()

# Get complete data and phylogeny
complete.data <- completePhyloData(
phylogeny = simulated_traits.data$phylogeny,
dataset = simulated_traits.data$data,
traits = colnames(simulated_traits.data$data),
taxon_name = "animal")

# Data frame with complete data for the specified traits
complete.data$dta

# Phylogeny for the complete data

complete.data$phylo

## End(Not run)

pablosanchezmart/TrEvol documentation built on April 23, 2024, 4:05 p.m.