ouwie_tidy: Wrapper OUwie function

View source: R/ouwie_tidy.R

ouwie_tidyR Documentation

Wrapper OUwie function

Description

This function allows you to run OUwie across all combinations of trees, simmaps, models, and continuous traits and outputs analyses in a neat tibble.

Usage

ouwie_tidy(
  phy,
  disc_trait,
  cont_traits,
  models,
  nsim,
  tip_col = NULL,
  dir = NULL,
  ...
)

Arguments

phy

Phylogenetic tree(s) containing all species/specimens present in dataset.

disc_trait

Named vector of discrete characters where the names match the tree tips

cont_traits

Data frame containing a character column with tree tips and any number of columns containing continuous trait data. Order of columns does not matter.

models

Vector containing the set of models to run on each tree as designated in OUwie documentation

nsim

Number of simmaps to create and run all analyses on

tip_col

Optional; column name in "cont_traits" that matches tree tips

dir

Optional; the directory to save output to, otherwise will save to working directory

params

Optional; list of parameters to be passed to OUwie. NOTE: be aware that default OUwie parameters differ from the default OUwie documentation.

Value

Function returns a list of the following

input

Simmaps and traits originally input into OUwie

full_output

Raw tibble with all results

tidy_output

Tidy tibble summarizing results

References

Beaulieu, J. M., & O’Meara, B. 2014. OUwie: analysis of evolutionary rates in an OU framework.

Examples

#simulating dummy data to run through OUwie
phy <- pbtree(n = 20, nsim = 2)
disc_trait <- setNames(sample(letters[1:2], 20, replace = TRUE), phy[[1]]$tip.label)
cont_traits <- as_tibble(iris[1:20, 1:2]) %>%
 mutate(species = phy[[1]]$tip.label)

models <- c("BM1", "OUM") #set of models to run on each simmap

results <- ouwie_tidy(phy, disc_trait, cont_traits, models, nsim = 2)
results$tidy_output

stfriedman/tidyouwie documentation built on April 20, 2022, 8:45 p.m.