getBtimes: Get Branching Times From Parenthetic-Format Tree ('Newick')

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

Description

Reads a file containing an ultrametric tree in parenthetic format and returns a numeric vector of branching times, sorted from earliest to most recent.

Usage

1
getBtimes(file = NULL, string=NULL)

Arguments

file

a file containing a single tree in 'newick' (parenthetic) format

string

the name of an object containing a 'newick' tree character string

Details

This function requires the package ape. If ape has not been attached to the search path but exists in the R directory, it will automatically be loaded. If ape does not exist, you must install it by typing install.packages("ape") at the R prompt.

If tree is not ultrametric, an error message will be generated.

Value

a numeric vector of branching times

Author(s)

Dan Rabosky drabosky@umich.edu

See Also

getBtimes.batch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(agamids)
write.table(agamids, file = 'example.tre', quote=FALSE, 
                row.names = FALSE, col.names = FALSE)
 # the preceding lines generate a file 'example.tre' that can be 
 # read by 'getBtimes'
 
 agbtimes <- getBtimes(file = 'example.tre')
 #or alternatively:
 agbtimes <- getBtimes(string = agamids)
 #agbtimes is now a numeric vector of branching times
 
 plotLtt(agbtimes) #plot log-lineages through time for agamid data
 gamStat(agbtimes) #calculate gamma statistic for agamid data 
 unlink('example.tre') #clean-up. 

laser documentation built on Jan. 15, 2017, 4:49 p.m.