View source: R/util_infer_metadata_from_file.R
reformat_date | R Documentation |
If input array of strings are all encoding exactly 8 integers, test if each represents a valid dates. If so, add separation chars.
reformat_date(x)
x |
array of strings representing dates, see examples |
Implementation is intentionally simplified, only needs to catch most obvious cases (so ignore potential dates denoted as 6 numbers, etc.) Hardcoded "oldest year" is 1990, serves our use-case and adds robustness (we use this function in a scenario where any set of numbers can be supplied, but experiment samples are note likely 20+ years old) For ambiguous dates, e.g. 20102010 (20-10-2010 or 2010-20-10), prioritize year YYYYxxzz over xxzzYYYY
examples; reformat_date(x = c("20200220", "20200221")) reformat_date(x = c("20202002", "20202102")) reformat_date(x = c("11012002", "11022002"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.