# resolve: Resolves messy dates into a single value In messydates: A Flexible Class for Messy Dates

## Description

This collection of S3 methods 'resolve' messy dates into a single date according to some explicit bias, such as returning the minimum or maximum date, the mean, median, or modal date, or a random date from among the possible resolutions for each messy date. If the date is not 'messy' (i.e. has no annotations) then just that precise date is returned. This can be useful for various descriptive or inferential projects.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```## S3 method for class 'messydt' min(..., na.rm = TRUE) ## S3 method for class 'messydt' max(..., na.rm = TRUE) ## S3 method for class 'messydt' median(..., na.rm = TRUE) ## S3 method for class 'messydt' mean(..., trim = 0, na.rm = TRUE) modal(..., na.rm = FALSE) ## S3 method for class 'messydt' modal(..., na.rm = TRUE) random(..., size, replace = FALSE, prob = NULL) ## S3 method for class 'messydt' random(..., size, replace = FALSE, prob = NULL) ```

## Arguments

 `...` a messydt object `na.rm` Should NAs be removed? True by default. `trim` the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint. `size` a non-negative integer giving the number of items to choose. `replace` should sampling be with replacement? `prob` a vector of probability weights for obtaining the elements of the vector being sampled.

## Value

A single scalar or vector of dates

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```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")) d min(d) max(d) mean(d) median(d) modal(d) random(d) ```

messydates documentation built on Nov. 12, 2021, 5:06 p.m.