These functions expand on date ranges, sets of dates, and unspecified or approximate dates (annotated with '..', '', 'XX' or '~'). As these messydates may refer to several possible dates, the function "opens" these values to reveal a vector of all the possible dates implied. Imprecise dates (dates only containing information on year and/or month) are also expanded to include possible dates within that year and/or month. The function removes the annotation from dates with unreliable sources ('?'), before being expanded normally as though they were incomplete.

expand(x, approx_range = 0)

Arguments

x

A mdate object. If not an 'mdate' object, conversion is handled first with ´as_messydate()´.

approx_range

Range to expand approximate dates, or date components, annotated with '~', by default 0. That is, removes signs for approximate dates and treats these dates as precise dates. If 3, for example, adds 3 days for day approximation, 3 months for month approximation, 3 years for year/whole date approximation, 3 years and 3 months for year-month approximation, and 3 months and 3 days for month-day approximation.

Value

A list of dates, including all dates in each range or set.

Examples

d <- as_messydate(c("2008-03-25", "-2012-02-27", "2001-01?", "~2001",
"2001-01-01..2001-02-02", "{2001-01-01,2001-02-02}", "{2001-01,2001-02-02}",
"2008-XX-31", "..2002-02-03", "2001-01-03..", "28 BC"))
expand(d)
#> [[1]]
#> [1] "2008-03-25"
#> 
#> [[2]]
#> [1] "-2012-02-27"
#> 
#> [[3]]
#>  [1] "2001-01-01" "2001-01-02" "2001-01-03" "2001-01-04" "2001-01-05"
#>  [6] "2001-01-06" "2001-01-07" "2001-01-08" "2001-01-09" "2001-01-10"
#> [11] "2001-01-11" "2001-01-12" "2001-01-13" "2001-01-14" "2001-01-15"
#> [16] "2001-01-16" "2001-01-17" "2001-01-18" "2001-01-19" "2001-01-20"
#> [21] "2001-01-21" "2001-01-22" "2001-01-23" "2001-01-24" "2001-01-25"
#> [26] "2001-01-26" "2001-01-27" "2001-01-28" "2001-01-29" "2001-01-30"
#> [31] "2001-01-31"
#> 
#> [[4]]
#>   [1] "2001-01-01" "2001-01-02" "2001-01-03" "2001-01-04" "2001-01-05"
#>   [6] "2001-01-06" "2001-01-07" "2001-01-08" "2001-01-09" "2001-01-10"
#>  [11] "2001-01-11" "2001-01-12" "2001-01-13" "2001-01-14" "2001-01-15"
#>  [16] "2001-01-16" "2001-01-17" "2001-01-18" "2001-01-19" "2001-01-20"
#>  [21] "2001-01-21" "2001-01-22" "2001-01-23" "2001-01-24" "2001-01-25"
#>  [26] "2001-01-26" "2001-01-27" "2001-01-28" "2001-01-29" "2001-01-30"
#>  [31] "2001-01-31" "2001-02-01" "2001-02-02" "2001-02-03" "2001-02-04"
#>  [36] "2001-02-05" "2001-02-06" "2001-02-07" "2001-02-08" "2001-02-09"
#>  [41] "2001-02-10" "2001-02-11" "2001-02-12" "2001-02-13" "2001-02-14"
#>  [46] "2001-02-15" "2001-02-16" "2001-02-17" "2001-02-18" "2001-02-19"
#>  [51] "2001-02-20" "2001-02-21" "2001-02-22" "2001-02-23" "2001-02-24"
#>  [56] "2001-02-25" "2001-02-26" "2001-02-27" "2001-02-28" "2001-03-01"
#>  [61] "2001-03-02" "2001-03-03" "2001-03-04" "2001-03-05" "2001-03-06"
#>  [66] "2001-03-07" "2001-03-08" "2001-03-09" "2001-03-10" "2001-03-11"
#>  [71] "2001-03-12" "2001-03-13" "2001-03-14" "2001-03-15" "2001-03-16"
#>  [76] "2001-03-17" "2001-03-18" "2001-03-19" "2001-03-20" "2001-03-21"
#>  [81] "2001-03-22" "2001-03-23" "2001-03-24" "2001-03-25" "2001-03-26"
#>  [86] "2001-03-27" "2001-03-28" "2001-03-29" "2001-03-30" "2001-03-31"
#>  [91] "2001-04-01" "2001-04-02" "2001-04-03" "2001-04-04" "2001-04-05"
#>  [96] "2001-04-06" "2001-04-07" "2001-04-08" "2001-04-09" "2001-04-10"
#> [101] "2001-04-11" "2001-04-12" "2001-04-13" "2001-04-14" "2001-04-15"
#> [106] "2001-04-16" "2001-04-17" "2001-04-18" "2001-04-19" "2001-04-20"
#> [111] "2001-04-21" "2001-04-22" "2001-04-23" "2001-04-24" "2001-04-25"
#> [116] "2001-04-26" "2001-04-27" "2001-04-28" "2001-04-29" "2001-04-30"
#> [121] "2001-05-01" "2001-05-02" "2001-05-03" "2001-05-04" "2001-05-05"
#> [126] "2001-05-06" "2001-05-07" "2001-05-08" "2001-05-09" "2001-05-10"
#> [131] "2001-05-11" "2001-05-12" "2001-05-13" "2001-05-14" "2001-05-15"
#> [136] "2001-05-16" "2001-05-17" "2001-05-18" "2001-05-19" "2001-05-20"
#> [141] "2001-05-21" "2001-05-22" "2001-05-23" "2001-05-24" "2001-05-25"
#> [146] "2001-05-26" "2001-05-27" "2001-05-28" "2001-05-29" "2001-05-30"
#> [151] "2001-05-31" "2001-06-01" "2001-06-02" "2001-06-03" "2001-06-04"
#> [156] "2001-06-05" "2001-06-06" "2001-06-07" "2001-06-08" "2001-06-09"
#> [161] "2001-06-10" "2001-06-11" "2001-06-12" "2001-06-13" "2001-06-14"
#> [166] "2001-06-15" "2001-06-16" "2001-06-17" "2001-06-18" "2001-06-19"
#> [171] "2001-06-20" "2001-06-21" "2001-06-22" "2001-06-23" "2001-06-24"
#> [176] "2001-06-25" "2001-06-26" "2001-06-27" "2001-06-28" "2001-06-29"
#> [181] "2001-06-30" "2001-07-01" "2001-07-02" "2001-07-03" "2001-07-04"
#> [186] "2001-07-05" "2001-07-06" "2001-07-07" "2001-07-08" "2001-07-09"
#> [191] "2001-07-10" "2001-07-11" "2001-07-12" "2001-07-13" "2001-07-14"
#> [196] "2001-07-15" "2001-07-16" "2001-07-17" "2001-07-18" "2001-07-19"
#> [201] "2001-07-20" "2001-07-21" "2001-07-22" "2001-07-23" "2001-07-24"
#> [206] "2001-07-25" "2001-07-26" "2001-07-27" "2001-07-28" "2001-07-29"
#> [211] "2001-07-30" "2001-07-31" "2001-08-01" "2001-08-02" "2001-08-03"
#> [216] "2001-08-04" "2001-08-05" "2001-08-06" "2001-08-07" "2001-08-08"
#> [221] "2001-08-09" "2001-08-10" "2001-08-11" "2001-08-12" "2001-08-13"
#> [226] "2001-08-14" "2001-08-15" "2001-08-16" "2001-08-17" "2001-08-18"
#> [231] "2001-08-19" "2001-08-20" "2001-08-21" "2001-08-22" "2001-08-23"
#> [236] "2001-08-24" "2001-08-25" "2001-08-26" "2001-08-27" "2001-08-28"
#> [241] "2001-08-29" "2001-08-30" "2001-08-31" "2001-09-01" "2001-09-02"
#> [246] "2001-09-03" "2001-09-04" "2001-09-05" "2001-09-06" "2001-09-07"
#> [251] "2001-09-08" "2001-09-09" "2001-09-10" "2001-09-11" "2001-09-12"
#> [256] "2001-09-13" "2001-09-14" "2001-09-15" "2001-09-16" "2001-09-17"
#> [261] "2001-09-18" "2001-09-19" "2001-09-20" "2001-09-21" "2001-09-22"
#> [266] "2001-09-23" "2001-09-24" "2001-09-25" "2001-09-26" "2001-09-27"
#> [271] "2001-09-28" "2001-09-29" "2001-09-30" "2001-10-01" "2001-10-02"
#> [276] "2001-10-03" "2001-10-04" "2001-10-05" "2001-10-06" "2001-10-07"
#> [281] "2001-10-08" "2001-10-09" "2001-10-10" "2001-10-11" "2001-10-12"
#> [286] "2001-10-13" "2001-10-14" "2001-10-15" "2001-10-16" "2001-10-17"
#> [291] "2001-10-18" "2001-10-19" "2001-10-20" "2001-10-21" "2001-10-22"
#> [296] "2001-10-23" "2001-10-24" "2001-10-25" "2001-10-26" "2001-10-27"
#> [301] "2001-10-28" "2001-10-29" "2001-10-30" "2001-10-31" "2001-11-01"
#> [306] "2001-11-02" "2001-11-03" "2001-11-04" "2001-11-05" "2001-11-06"
#> [311] "2001-11-07" "2001-11-08" "2001-11-09" "2001-11-10" "2001-11-11"
#> [316] "2001-11-12" "2001-11-13" "2001-11-14" "2001-11-15" "2001-11-16"
#> [321] "2001-11-17" "2001-11-18" "2001-11-19" "2001-11-20" "2001-11-21"
#> [326] "2001-11-22" "2001-11-23" "2001-11-24" "2001-11-25" "2001-11-26"
#> [331] "2001-11-27" "2001-11-28" "2001-11-29" "2001-11-30" "2001-12-01"
#> [336] "2001-12-02" "2001-12-03" "2001-12-04" "2001-12-05" "2001-12-06"
#> [341] "2001-12-07" "2001-12-08" "2001-12-09" "2001-12-10" "2001-12-11"
#> [346] "2001-12-12" "2001-12-13" "2001-12-14" "2001-12-15" "2001-12-16"
#> [351] "2001-12-17" "2001-12-18" "2001-12-19" "2001-12-20" "2001-12-21"
#> [356] "2001-12-22" "2001-12-23" "2001-12-24" "2001-12-25" "2001-12-26"
#> [361] "2001-12-27" "2001-12-28" "2001-12-29" "2001-12-30" "2001-12-31"
#> 
#> [[5]]
#>  [1] "2001-01-01" "2001-01-02" "2001-01-03" "2001-01-04" "2001-01-05"
#>  [6] "2001-01-06" "2001-01-07" "2001-01-08" "2001-01-09" "2001-01-10"
#> [11] "2001-01-11" "2001-01-12" "2001-01-13" "2001-01-14" "2001-01-15"
#> [16] "2001-01-16" "2001-01-17" "2001-01-18" "2001-01-19" "2001-01-20"
#> [21] "2001-01-21" "2001-01-22" "2001-01-23" "2001-01-24" "2001-01-25"
#> [26] "2001-01-26" "2001-01-27" "2001-01-28" "2001-01-29" "2001-01-30"
#> [31] "2001-01-31" "2001-02-01" "2001-02-02"
#> 
#> [[6]]
#> [1] "2001-01-01" "2001-02-02"
#> 
#> [[7]]
#>  [1] "2001-01-01" "2001-01-02" "2001-01-03" "2001-01-04" "2001-01-05"
#>  [6] "2001-01-06" "2001-01-07" "2001-01-08" "2001-01-09" "2001-01-10"
#> [11] "2001-01-11" "2001-01-12" "2001-01-13" "2001-01-14" "2001-01-15"
#> [16] "2001-01-16" "2001-01-17" "2001-01-18" "2001-01-19" "2001-01-20"
#> [21] "2001-01-21" "2001-01-22" "2001-01-23" "2001-01-24" "2001-01-25"
#> [26] "2001-01-26" "2001-01-27" "2001-01-28" "2001-01-29" "2001-01-30"
#> [31] "2001-01-31" "2001-02-02"
#> 
#> [[8]]
#>  [1] "2008-01-31" "2008-02-28" "2008-03-31" "2008-04-30" "2008-05-31"
#>  [6] "2008-06-30" "2008-07-31" "2008-08-31" "2008-09-30" "2008-10-31"
#> [11] "2008-11-30" "2008-12-31"
#> 
#> [[9]]
#> [1] "2002-02-03"
#> 
#> [[10]]
#> [1] "2001-01-03"
#> 
#> [[11]]
#>   [1] "-0028-01-01" "-0028-01-02" "-0028-01-03" "-0028-01-04" "-0028-01-05"
#>   [6] "-0028-01-06" "-0028-01-07" "-0028-01-08" "-0028-01-09" "-0028-01-10"
#>  [11] "-0028-01-11" "-0028-01-12" "-0028-01-13" "-0028-01-14" "-0028-01-15"
#>  [16] "-0028-01-16" "-0028-01-17" "-0028-01-18" "-0028-01-19" "-0028-01-20"
#>  [21] "-0028-01-21" "-0028-01-22" "-0028-01-23" "-0028-01-24" "-0028-01-25"
#>  [26] "-0028-01-26" "-0028-01-27" "-0028-01-28" "-0028-01-29" "-0028-01-30"
#>  [31] "-0028-01-31" "-0028-02-01" "-0028-02-02" "-0028-02-03" "-0028-02-04"
#>  [36] "-0028-02-05" "-0028-02-06" "-0028-02-07" "-0028-02-08" "-0028-02-09"
#>  [41] "-0028-02-10" "-0028-02-11" "-0028-02-12" "-0028-02-13" "-0028-02-14"
#>  [46] "-0028-02-15" "-0028-02-16" "-0028-02-17" "-0028-02-18" "-0028-02-19"
#>  [51] "-0028-02-20" "-0028-02-21" "-0028-02-22" "-0028-02-23" "-0028-02-24"
#>  [56] "-0028-02-25" "-0028-02-26" "-0028-02-27" "-0028-02-28" "-0028-02-29"
#>  [61] "-0028-03-01" "-0028-03-02" "-0028-03-03" "-0028-03-04" "-0028-03-05"
#>  [66] "-0028-03-06" "-0028-03-07" "-0028-03-08" "-0028-03-09" "-0028-03-10"
#>  [71] "-0028-03-11" "-0028-03-12" "-0028-03-13" "-0028-03-14" "-0028-03-15"
#>  [76] "-0028-03-16" "-0028-03-17" "-0028-03-18" "-0028-03-19" "-0028-03-20"
#>  [81] "-0028-03-21" "-0028-03-22" "-0028-03-23" "-0028-03-24" "-0028-03-25"
#>  [86] "-0028-03-26" "-0028-03-27" "-0028-03-28" "-0028-03-29" "-0028-03-30"
#>  [91] "-0028-03-31" "-0028-04-01" "-0028-04-02" "-0028-04-03" "-0028-04-04"
#>  [96] "-0028-04-05" "-0028-04-06" "-0028-04-07" "-0028-04-08" "-0028-04-09"
#> [101] "-0028-04-10" "-0028-04-11" "-0028-04-12" "-0028-04-13" "-0028-04-14"
#> [106] "-0028-04-15" "-0028-04-16" "-0028-04-17" "-0028-04-18" "-0028-04-19"
#> [111] "-0028-04-20" "-0028-04-21" "-0028-04-22" "-0028-04-23" "-0028-04-24"
#> [116] "-0028-04-25" "-0028-04-26" "-0028-04-27" "-0028-04-28" "-0028-04-29"
#> [121] "-0028-04-30" "-0028-05-01" "-0028-05-02" "-0028-05-03" "-0028-05-04"
#> [126] "-0028-05-05" "-0028-05-06" "-0028-05-07" "-0028-05-08" "-0028-05-09"
#> [131] "-0028-05-10" "-0028-05-11" "-0028-05-12" "-0028-05-13" "-0028-05-14"
#> [136] "-0028-05-15" "-0028-05-16" "-0028-05-17" "-0028-05-18" "-0028-05-19"
#> [141] "-0028-05-20" "-0028-05-21" "-0028-05-22" "-0028-05-23" "-0028-05-24"
#> [146] "-0028-05-25" "-0028-05-26" "-0028-05-27" "-0028-05-28" "-0028-05-29"
#> [151] "-0028-05-30" "-0028-05-31" "-0028-06-01" "-0028-06-02" "-0028-06-03"
#> [156] "-0028-06-04" "-0028-06-05" "-0028-06-06" "-0028-06-07" "-0028-06-08"
#> [161] "-0028-06-09" "-0028-06-10" "-0028-06-11" "-0028-06-12" "-0028-06-13"
#> [166] "-0028-06-14" "-0028-06-15" "-0028-06-16" "-0028-06-17" "-0028-06-18"
#> [171] "-0028-06-19" "-0028-06-20" "-0028-06-21" "-0028-06-22" "-0028-06-23"
#> [176] "-0028-06-24" "-0028-06-25" "-0028-06-26" "-0028-06-27" "-0028-06-28"
#> [181] "-0028-06-29" "-0028-06-30" "-0028-07-01" "-0028-07-02" "-0028-07-03"
#> [186] "-0028-07-04" "-0028-07-05" "-0028-07-06" "-0028-07-07" "-0028-07-08"
#> [191] "-0028-07-09" "-0028-07-10" "-0028-07-11" "-0028-07-12" "-0028-07-13"
#> [196] "-0028-07-14" "-0028-07-15" "-0028-07-16" "-0028-07-17" "-0028-07-18"
#> [201] "-0028-07-19" "-0028-07-20" "-0028-07-21" "-0028-07-22" "-0028-07-23"
#> [206] "-0028-07-24" "-0028-07-25" "-0028-07-26" "-0028-07-27" "-0028-07-28"
#> [211] "-0028-07-29" "-0028-07-30" "-0028-07-31" "-0028-08-01" "-0028-08-02"
#> [216] "-0028-08-03" "-0028-08-04" "-0028-08-05" "-0028-08-06" "-0028-08-07"
#> [221] "-0028-08-08" "-0028-08-09" "-0028-08-10" "-0028-08-11" "-0028-08-12"
#> [226] "-0028-08-13" "-0028-08-14" "-0028-08-15" "-0028-08-16" "-0028-08-17"
#> [231] "-0028-08-18" "-0028-08-19" "-0028-08-20" "-0028-08-21" "-0028-08-22"
#> [236] "-0028-08-23" "-0028-08-24" "-0028-08-25" "-0028-08-26" "-0028-08-27"
#> [241] "-0028-08-28" "-0028-08-29" "-0028-08-30" "-0028-08-31" "-0028-09-01"
#> [246] "-0028-09-02" "-0028-09-03" "-0028-09-04" "-0028-09-05" "-0028-09-06"
#> [251] "-0028-09-07" "-0028-09-08" "-0028-09-09" "-0028-09-10" "-0028-09-11"
#> [256] "-0028-09-12" "-0028-09-13" "-0028-09-14" "-0028-09-15" "-0028-09-16"
#> [261] "-0028-09-17" "-0028-09-18" "-0028-09-19" "-0028-09-20" "-0028-09-21"
#> [266] "-0028-09-22" "-0028-09-23" "-0028-09-24" "-0028-09-25" "-0028-09-26"
#> [271] "-0028-09-27" "-0028-09-28" "-0028-09-29" "-0028-09-30" "-0028-10-01"
#> [276] "-0028-10-02" "-0028-10-03" "-0028-10-04" "-0028-10-05" "-0028-10-06"
#> [281] "-0028-10-07" "-0028-10-08" "-0028-10-09" "-0028-10-10" "-0028-10-11"
#> [286] "-0028-10-12" "-0028-10-13" "-0028-10-14" "-0028-10-15" "-0028-10-16"
#> [291] "-0028-10-17" "-0028-10-18" "-0028-10-19" "-0028-10-20" "-0028-10-21"
#> [296] "-0028-10-22" "-0028-10-23" "-0028-10-24" "-0028-10-25" "-0028-10-26"
#> [301] "-0028-10-27" "-0028-10-28" "-0028-10-29" "-0028-10-30" "-0028-10-31"
#> [306] "-0028-11-01" "-0028-11-02" "-0028-11-03" "-0028-11-04" "-0028-11-05"
#> [311] "-0028-11-06" "-0028-11-07" "-0028-11-08" "-0028-11-09" "-0028-11-10"
#> [316] "-0028-11-11" "-0028-11-12" "-0028-11-13" "-0028-11-14" "-0028-11-15"
#> [321] "-0028-11-16" "-0028-11-17" "-0028-11-18" "-0028-11-19" "-0028-11-20"
#> [326] "-0028-11-21" "-0028-11-22" "-0028-11-23" "-0028-11-24" "-0028-11-25"
#> [331] "-0028-11-26" "-0028-11-27" "-0028-11-28" "-0028-11-29" "-0028-11-30"
#> [336] "-0028-12-01" "-0028-12-02" "-0028-12-03" "-0028-12-04" "-0028-12-05"
#> [341] "-0028-12-06" "-0028-12-07" "-0028-12-08" "-0028-12-09" "-0028-12-10"
#> [346] "-0028-12-11" "-0028-12-12" "-0028-12-13" "-0028-12-14" "-0028-12-15"
#> [351] "-0028-12-16" "-0028-12-17" "-0028-12-18" "-0028-12-19" "-0028-12-20"
#> [356] "-0028-12-21" "-0028-12-22" "-0028-12-23" "-0028-12-24" "-0028-12-25"
#> [361] "-0028-12-26" "-0028-12-27" "-0028-12-28" "-0028-12-29" "-0028-12-30"
#> [366] "-0028-12-31"
#>