tipranges_to_area_strings: Convert tipranges binary coding to range strings

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/BioGeoBEARS_basics_v1.R

Description

This function converts the 0110-type format of the tipranges object into a list of strings describing the geographic ranges. E.g., 1100 becomes AB, 0111 become BCD (assuming the regions are abbreviated A, B, C...). Users can input their preferred abbreviations with areaabbr.

Usage

1

Arguments

tipranges

An object of class tipranges.

areaabbr

A vector of the abbreviations (preferably 1 character each).

Details

Note that you will HAVE to use order_tipranges_by_tree_tips on the tipranges object first, to make sure the tipranges are in the correct order on the tree tips.

Value

tiprange_names A vector of strings.

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

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

order_tipranges_by_tree_tips, define_tipranges_object, save_tipranges_to_LagrangePHYLIP

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# 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
tipranges_to_area_strings(tipranges=tipranges1, areaabbr=NULL)
tipranges_to_area_strings(tipranges=tipranges1, areaabbr=c("K", "O", "M", "H"))

# Reorder the tipranges object
tipranges2 = order_tipranges_by_tree_tips(tipranges1, tr)
tipranges2
tipranges_to_area_strings(tipranges=tipranges2, areaabbr=NULL)
tipranges_to_area_strings(tipranges=tipranges2, areaabbr=c("K", "O", "M", "H"))

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.