sampleYearsFromLabels function

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

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

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

Returns

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]+')
  • Maintainer: Erik Volz
  • License: GPL-2
  • Last published: 2020-01-26

Useful links