Learn R Programming

BioGeoBEARS (version 0.2.1)

order_tipranges_by_tree_tips: Reorder the rows in a tipranges object, to correspond to tree tips

Description

The tipranges object, as read from a LAGRANGE/PHYLIP-style geography file, may not have the species names as the same order as they are in the tips of the tree. This function allows the user to reorder them to match the tree

Usage

order_tipranges_by_tree_tips(tipranges, tr)

Arguments

tipranges
An object of class tipranges.
tr
A phylo tree object.

Value

tipranges An object of class tipranges

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster https://code.google.com/p/lagrange/

Matzke_2012_IBS

ReeSmith2008

SmithRee2010_CPPversion

See Also

tipranges_to_area_strings, define_tipranges_object, save_tipranges_to_LagrangePHYLIP

Examples

Run this code
testval=1

# Get the example files directory
extdata_dir = np(system.file("extdata", package="BioGeoBEARS"))
# tmp hard code:
# extdata_dir = "/Dropbox/_njm/__packages/BioGeoBEARS_setup/inst/extdata/"
# Set the filename (Hawaiian Psychotria from Ree & Smith 2008)

trfn = np(paste(extdata_dir, "/Psychotria_5.2.newick", sep=""))
tr = read.tree(trfn)

fn = np(paste(extdata_dir, "/Psychotria_geog.data", sep=""))
tipranges1 = getranges_from_LagrangePHYLIP(lgdata_fn=fn)
tipranges1

# Reorder the tipranges object
tipranges2 = order_tipranges_by_tree_tips(tipranges1, tr)
tipranges2

Run the code above in your browser using DataLab