This function is used to calculate the phylogenetic species variability (PSV) for the geographic features of interest from a list of community matrices such as produced by com_matrix(). This function requires the package 'phyr'

PSV_geo(tree, data, geo_group)

Arguments

tree

A phylogenetic tree that includes as many species as possible that are in the data. Should be in the Newick format.

data

A list of community matrices that have column with the geographic names. Each entry in the list should be a different species group and that list entry should be named with the group name. The resulting object from the com_matrix() is already formatted for this function.

geo_name

A character equal to the column name of the data frame(s) in 'data' in which the geographic feature names are stored

Value

A list of data frames. The first data frame holds the PSV values for each geographic feature and species group. If there is less than two species of a community in tree then the function returns an NA for the PSV value for that community.

The second data frame holds the number of taxa (e.g. species) used to calculate the PSV value for each geographic feature and species group.

The third data frame holds the 'Vars' values for each geographic feature and species group.

Examples

if (FALSE) {

library(here)
library(reshape)
library(phyr)

tetra <- read.tree(file.path(here(), 'data_raw', 'Tetrapoda_species.nwk'))
dat <- read.csv(file.path(here(), 'data_raw', 'IBT_Herp_Records_final.csv'), header=TRUE)

coms <- com_matrix(species = "binomial",
                   geo_group = "bank",
                   taxa_group = "class",
                   status = "bnk_status",
                   stat_levels = c('N', "E"),
                   total = TRUE,
                   data = dat)

PSV <- PSV_geo(tree = tetra, data = coms, geo_group = 'bank')

}