sampleYearsFromLabels {treedater} | R Documentation |
Compute a vector of numeric sample times from labels in a sequence aligment or phylogeny
Description
Compute a vector of numeric sample times from labels in a sequence aligment or phylogeny
Usage
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
## 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]+')
[Package treedater version 0.5.0 Index]