Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9aa3982
Moved mreport to manydata
jhollway Feb 26, 2025
b6fae8c
Fixed some issues with how coercion from messydates was working with …
jhollway Feb 27, 2025
01df178
Fixed bug in how min.mdate() and max.mdate() handled recursivity
jhollway Feb 27, 2025
dbd3a70
Consolidated scripts relating to the construction of mdate and mdurat…
jhollway Feb 28, 2025
f87e084
Consolidated and rationalised structure of coercion scripts
jhollway Feb 28, 2025
736a6df
Sequence method now gets own script
jhollway Feb 28, 2025
9cf137c
Consolidated operate_ scripts and tests
jhollway Feb 28, 2025
0a17734
Added vmin.mdate() and vmax.mdate() instead of recursive argument on …
jhollway Mar 1, 2025
ceb214b
Fixed precision to return a vector of precisions, users can sum if th…
jhollway Mar 1, 2025
40bc3dd
Dropped median.mdate(), modal.mdate(), and mean.mdate() for now until…
jhollway Mar 1, 2025
5733d5a
Using vmin() and vmax() throughout
jhollway Mar 1, 2025
c26416f
Rename help some operate help files
jhollway Mar 6, 2025
1791047
Fixed pkgdown#2855 by dropping operators (inequalities) because they …
jhollway Mar 6, 2025
a7bed2f
Fixed how as_messydate methods interpret infinite quantities
jhollway Mar 7, 2025
8cf98b9
Fixed operate_proportional documentation
jhollway Mar 7, 2025
478e3ee
Reinstated inequalities
jhollway Mar 7, 2025
dcf99c1
Fixed time zone defaults in as.POSIXct() and as.POSIXlt()
jhollway Mar 7, 2025
c7a6fc2
Fixed set bug in validate_messydate()
jhollway Mar 7, 2025
a600fa9
Updated documentation on inequalitites and statements
jhollway Mar 7, 2025
1811596
as.numeric() changed to as.double() so that the S3 method is found co…
jhollway Mar 7, 2025
b419808
Moved extrema to own script
jhollway Mar 7, 2025
22f512a
Added median() and vmedian() back in, works faster
jhollway Mar 7, 2025
d20dc92
Added mean.mdate() and vmean.mdate() back in, works better for BCE dates
jhollway Mar 7, 2025
4a852d8
Added modal.mdate() and vmodal.mdate() back in
jhollway Mar 7, 2025
ee4a9da
Added random.mdate() and vrandom.mdate() back in
jhollway Mar 7, 2025
381e4b7
Fixed timezone bug in as.POSIXct.mdate(), now uses "UTC" by default
jhollway Mar 7, 2025
7f28078
version updates
jhollway Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
^CRAN-SUBMISSION$
^article$
^.DS_Store$
^next$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ article/jsslogo.jpg
article/references.bib
article/article_files
vignettes-old
next

4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Description: Contains a set of tools for constructing and coercing
date ranges, and sets of dates.
This is useful for describing and analysing temporal information,
whether historical or recent, where date precision may vary.
Version: 0.5.1
Date: 2025-02-25
Version: 0.5.2
Date: 2025-03-07
Authors@R:
c(person(given = "James",
family = "Hollway",
Expand Down
20 changes: 14 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ S3method(as.Date,mdate)
S3method(as.POSIXct,mdate)
S3method(as.POSIXlt,mdate)
S3method(as.data.frame,mdate)
S3method(as.double,mdate)
S3method(as.list,mdate)
S3method(as.numeric,mdate)
S3method(as_messydate,Date)
S3method(as_messydate,POSIXct)
S3method(as_messydate,POSIXlt)
Expand All @@ -39,13 +39,18 @@ S3method(messyduration,character)
S3method(messyduration,mdate)
S3method(min,mdate)
S3method(modal,mdate)
S3method(mreport,default)
S3method(print,mdate)
S3method(print,mdates_duration)
S3method(print,mreport)
S3method(random,character)
S3method(random,mdate)
S3method(rep,mdate)
S3method(seq,mdate)
S3method(vmax,mdate)
S3method(vmean,mdate)
S3method(vmedian,mdate)
S3method(vmin,mdate)
S3method(vmodal,mdate)
S3method(vrandom,mdate)
export("%><%")
export("%>=<%")
export("%g%")
Expand Down Expand Up @@ -77,7 +82,6 @@ export(mdate)
export(messyduration)
export(modal)
export(month)
export(mreport)
export(new_messydate)
export(new_messyduration)
export(on_or_after)
Expand All @@ -86,8 +90,13 @@ export(precision)
export(random)
export(validate_messydate)
export(validate_messyduration)
export(vmax)
export(vmean)
export(vmedian)
export(vmin)
export(vmodal)
export(vrandom)
export(year)
importFrom(dplyr,"%>%")
importFrom(dplyr,first)
importFrom(dplyr,last)
importFrom(dplyr,lead)
Expand All @@ -99,7 +108,6 @@ importFrom(lubridate,ymd)
importFrom(purrr,map)
importFrom(purrr,pmap_chr)
importFrom(stats,median)
importFrom(stats,na.omit)
importFrom(stringi,stri_detect_regex)
importFrom(stringi,stri_extract_all_regex)
importFrom(stringi,stri_replace_all_fixed)
Expand Down
27 changes: 27 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# messydates 0.5.2

## Package

- Moved `mreport()` to `{manydata}`
- Consolidated and renamed scripts internally

## Coerce to

- Fixed pkgdown#2855 by fixing how as_messydate methods interpret infinite dates
- Fixed time zone defaults in `as.POSIXct.mdate()` and `as.POSIXlt.mdate()`
- Fixed set bug in `validate_messydate()`

## Coerce from

- Renamed `as.numeric()` to `as.double()` to fix S3 dispatching
- Separated extrema functions into `min.mdate()` and `max.mdate()` for summaries
and `vmin.mdate()` and `vmax.mdate()` for vector coercion
- Separated tendency functions into `mean.mdate()`, `median.mdate()`, and `modal.mdate()` for summaries
and `vmean.mdate()`, `vmedian.mdate()`, and `vmodal.mdate()` for vector coercion
- Vector coercion previously in `random.mdate()` now in `vrandom.mdate()`
- Improved how coercion/resolution functions handle BCE dates

## Manipulation

- Fixed how `precision()` calculates precision

# messydates 0.5.1

## Package
Expand Down
213 changes: 0 additions & 213 deletions R/class.R

This file was deleted.

18 changes: 6 additions & 12 deletions R/duration.R → R/class_duration.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,23 @@
#' @param approx_range Range to expand approximate dates, in days.
#' If 3, for example, adds 3 days; if -3, removes 3 days from both sides.
#' @return Object of class `description`
#' @name duration_class
#' @name class_duration
#' @examples
#' messyduration(as_messydate(c("2010-01-01..2010-12-31", "2010-01..2010-12")))
NULL

#' @rdname duration_class
#' @rdname class_duration
#' @export
new_messyduration <- function(x = character()) {
stopifnot(is.character(x))
structure(x, class = "mdates_duration")
}

#' @importFrom utils str
#' @export
print.mdates_duration <- function(x, ...) {
str(x)
}

#' @rdname duration_class
#' @rdname class_duration
#' @export
messyduration <- function(x, approx_range = 0) UseMethod("messyduration")

#' @rdname duration_class
#' @rdname class_duration
#' @export
validate_messyduration <- function(x, approx_range = 0) {
if (any(!grepl("\\.\\.", x))) {
Expand All @@ -43,7 +37,7 @@ validate_messyduration <- function(x, approx_range = 0) {
}
}

#' @rdname duration_class
#' @rdname class_duration
#' @export
messyduration.character <- function(x, approx_range = 0) {
message("Converting to mdate class.")
Expand All @@ -53,7 +47,7 @@ messyduration.character <- function(x, approx_range = 0) {
new_messyduration(x)
}

#' @rdname duration_class
#' @rdname class_duration
#' @export
messyduration.mdate <- function(x, approx_range = 0) {
validate_messyduration(x)
Expand Down
Loading
Loading