CladeByTrait: Extract Clades Based on Trait Values

View source: R/CladeByTrait.R

CladeByTraitR Documentation

Extract Clades Based on Trait Values

Description

Extract clades from a larger phylogeny based on a binary trait, with options to choose minimum and maximum clade size as well as the fraction of species sharing the trait

Usage

CladeByTrait(x, tree, prefix, min_clade_size, max_clade_size, 
             monophyly_threshold, summary = FALSE)

Arguments

x

a data.frame, with two columns: species, and the binary trait of interest (1 = present, 0 = absent, NA values permitted).

tree

a phylo object. The phylogenetic tree from which the clades shall be extracted.

prefix

a character string. A prefix for the output file names.

min_clade_size

numeric. The minimum number of tips in the resulting clades.

max_clade_size

numeric. The maximum number of tips in the resulting clades.

monophyly_threshold

numeric. The number of species in a clade permitted not to exhibit the trait of interest.

summary

logical. If TRUE a summary file is written to disk.

Value

A set of nexus files and plots in the working directory

Note

See https://github.com/azizka/speciesgeocodeR/wiki for more details and tutorials.

Author(s)

Alexander Zizka, Ruud Scharn

Examples

sp.nam <-  unique(paste(sample(letters, size = 250, replace = TRUE), 
                        sample(letters, size = 250, replace = TRUE),
			                  sep = ""))
tr.dat <- sample(c(0,1), size = length(sp.nam), replace = TRUE)
trait <- data.frame(species = sp.nam, trait = tr.dat)

azizka/speciesgeocodeR documentation built on Sept. 5, 2023, 3:45 a.m.