sampleYearsFromLabels: Compute a vector of numeric sample times from labels in a...

Description Usage Arguments Value Examples

View source: R/treedater0.R

Description

Compute a vector of numeric sample times from labels in a sequence aligment or phylogeny

Usage

1
2
sampleYearsFromLabels(tips, dateFormat = "%Y-%m-%d",
  delimiter = NULL, index = NULL, regex = NULL)

Arguments

tips

A character vector supplying the name of each sample

dateFormat

The format of the sample date. See ?Date for more information

delimiter

Character(s) which separate data in each label

index

Integer position of the date string in each label with respect to *delimiter*

regex

A regular expression for finding the date substring. Should not be used with *delimiter* or *index*

Value

Numeric vector with sample time in decimal format.

Examples

1
2
3
4
5
6
7
8
## A couple of labels for Ebola virus sequences: 
sampleYearsFromLabels( c('EBOV|AA000000|EM104|SierraLeone_EM|2014-06-02'
                       , 'EBOV|AA000000|G3713|SierraLeone_G|2014-06-09')
, delimiter='|' )
## Equivalently: 
sampleYearsFromLabels( c('EBOV|AA000000|EM104|SierraLeone_EM|2014-06-02'
                       , 'EBOV|AA000000|G3713|SierraLeone_G|2014-06-09')
 , regex='[0-9]+-[0-9]+-[0-9]+')

emvolz-phylodynamics/treedater-dev documentation built on Jan. 28, 2020, 6:05 p.m.