Description Usage Arguments Details Value Examples
date function for matching
1 2 |
dat1, dat2 |
a vector of dates to match |
dat1Format, dat2Format |
format of dates to pass to lubridate in the form of "mdy" or "ymd" etc. |
threshold |
in days, otherwise returns scaled values |
The formats for dates are passed to lubridate's function
parse_date_time
, so they need to be in the format "mdy" or
"ymd", etc.
a pairwise matrix of scores from 0 (exact match) to 1 (no match)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Two data sets in Month-Day-Year and Year-Month-Day format, respectively.
# Note that the way the dates can vary within data sets, but it's assumed
# that the order within a data set is consistant.
test1 <- data.frame(x = c("Jan-21-01", "01-25-02"), stringsAsFactors = FALSE)
test2 <- data.frame(x = c("01-JAN-21", "2001-Jan-31"), stringsAsFactors = FALSE)
# match dates within 11 days of each other
dateDists(test1, test2, dat1Format = "mdy", dat2Format = "ymd", threshold = 11)
# exact match of dates
dateDists(test1, test2, dat1Format = "mdy", dat2Format = "ymd")
# relative distance of dates by setting threshold to NULL
dateDists(test1, test2, dat1Format = "mdy", dat2Format = "ymd", threshold = NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.