Learn R Programming

messydates (version 0.5.3)

coerce_extrema: Resolves messy dates into an extrema

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

vmin(..., na.rm = FALSE)

# S3 method for mdate vmin(..., na.rm = TRUE)

# S3 method for mdate min(..., na.rm = TRUE)

vmax(..., na.rm = FALSE)

# S3 method for mdate vmax(..., na.rm = TRUE)

# S3 method for mdate max(..., na.rm = TRUE)

Value

A single scalar or vector of dates

Arguments

...

a mdate object

na.rm

Should NAs be removed? True by default.

Examples

Run this code
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", "-0050-01-01"))
d
vmin(d)
min(d)
vmax(d)
max(d)

Run the code above in your browser using DataLab