Skip to content

Commit 0a532bd

Browse files
author
Stefan Fleck
committed
compatibility with ggplot2 >= 3.2.2
fixes #3
1 parent 523c010 commit 0a532bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+823
-615
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Type: Package
22
Package: dint
33
Title: A Toolkit for Year-Quarter, Year-Month and Year-Isoweek
44
Dates
5-
Version: 2.1.1
5+
Version: 2.1.2
66
Authors@R:
77
person(given = "Stefan",
88
family = "Fleck",
@@ -32,7 +32,7 @@ VignetteBuilder:
3232
Encoding: UTF-8
3333
LazyData: true
3434
Roxygen: list(markdown = TRUE)
35-
RoxygenNote: 7.0.1.9000
35+
RoxygenNote: 7.0.2.9000
3636
Collate:
3737
'accessors.R'
3838
'arithmetic.R'

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# dint 2.1.2
2+
3+
* Updated all `scale_date_*()` functions for comptability with ggplot2 >= 3.2.2
4+
5+
16
# dint 2.1.1
27

38
* `format.date_xx()` now used `%V` for isoweeks instead of `%W`

R/scale_date_xx.R

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ scale_date_yq <- function(
129129
name = name,
130130
palette = identity,
131131
labels = labels,
132-
guide = "none",
132+
guide = default_guide(),
133133
trans = date_yq_trans,
134134
super = ggplot2::ScaleContinuousDate,
135135
position = position,
@@ -203,7 +203,7 @@ scale_date_ym <- function(
203203
breaks = breaks,
204204
palette = identity,
205205
labels = labels,
206-
guide = "none",
206+
guide = default_guide(),
207207
trans = date_ym_trans,
208208
super = ggplot2::ScaleContinuousDate,
209209
position = position,
@@ -272,7 +272,7 @@ scale_date_yw <- function(
272272
name = name,
273273
breaks = breaks,
274274
palette = identity,
275-
guide = "none",
275+
guide = default_guide(),
276276
labels = labels,
277277
trans = date_yw_trans,
278278
super = ggplot2::ScaleContinuousDate,
@@ -486,3 +486,13 @@ round_frac <- function(
486486
){
487487
(x %/% 1) + round((x %% 1) * denom) / denom
488488
}
489+
490+
491+
492+
default_guide <- function(){
493+
if (utils::packageVersion("ggplot2") >= "3.2.1.9000") {
494+
ggplot2::waiver()
495+
} else {
496+
"none"
497+
}
498+
}

R/zoo-compat.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ as_yearqtr.yearqtr <- function(x){
6464
#' @noRd
6565
#'
6666
yearqtr <- function(x){
67-
assert(all((x %% 1) %in% c(0, 0.25, 0.5, 0.75)))
67+
assert(all((x %% 1) %in% c(NA_real_, 0, 0.25, 0.5, 0.75)))
6868
structure(x, class = c("yearqtr", "numeric"))
6969
}
7070

@@ -111,7 +111,7 @@ as_yearmon.yearmon <- function(x){
111111
yearmon <- function(x){
112112
x <- as.numeric(x)
113113
assert(
114-
all(round(x %% 1, 5) %in% round(seq(0, 1, by = 1/12), 5))
114+
all(round(x %% 1, 5) %in% c(NA_real_, round(seq(0, 1, by = 1/12), 5)))
115115
)
116116
structure(x, class = c("yearmon", "numeric"))
117117
}
@@ -161,7 +161,7 @@ as_yearweek.yearweek <- function(x){
161161
yearweek <- function(x){
162162
x <- as.numeric(x)
163163
assert(
164-
all(round(x %% 1, 5) %in% round(seq(0, 1, by = 1/53), 5))
164+
all(round(x %% 1, 5) %in% c(NA_real_, round(seq(0, 1, by = 1/53), 5)))
165165
)
166166
structure(x, class = c("yearweek", "numeric"))
167167
}

README.Rmd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ devtools::install_github("s-fleck/dint")
5555

5656

5757

58-
5958
## Example
6059

6160
```{r example}

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11

22
<!-- README.md is generated from README.Rmd. Please edit that file -->
3-
dint
4-
====
53

6-
[![CRAN status](https://www.r-pkg.org/badges/version/dint)](https://cran.r-project.org/package=dint) [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) [![Travis build status](https://travis-ci.org/s-fleck/dint.svg?branch=master)](https://travis-ci.org/s-fleck/dint) [![Coverage status](https://codecov.io/gh/s-fleck/dint/branch/master/graph/badge.svg)](https://codecov.io/github/s-fleck/dint?branch=master)
4+
# dint
5+
6+
[![CRAN
7+
status](https://www.r-pkg.org/badges/version/dint)](https://cran.r-project.org/package=dint)
8+
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
9+
[![Travis build
10+
status](https://travis-ci.org/s-fleck/dint.svg?branch=master)](https://travis-ci.org/s-fleck/dint)
11+
[![Coverage
12+
status](https://codecov.io/gh/s-fleck/dint/branch/master/graph/badge.svg)](https://codecov.io/github/s-fleck/dint?branch=master)
713

814
A Toolkit for Year-Quarter, Year-Month and Year-Isoweek Dates
915

10-
S3 classes and methods to create and work with year-quarter and year-month vectors. Basic arithmetic operations (such as adding and subtracting) are supported, as well as formatting and converting to and from standard R Date types. For more info please refer to the [package vignette](https://CRAN.R-project.org/package=dint/vignettes/dint.html) or the [documentation](https://s-fleck.github.io/dint/)
16+
S3 classes and methods to create and work with year-quarter and
17+
year-month vectors. Basic arithmetic operations (such as adding and
18+
subtracting) are supported, as well as formatting and converting to and
19+
from standard R Date types. For more info please refer to the [package
20+
vignette](https://CRAN.R-project.org/package=dint/vignettes/dint.html)
21+
or the [documentation](https://s-fleck.github.io/dint/)
1122

12-
Dependencies
13-
------------
23+
## Dependencies
1424

15-
dint is implemented strictly in base R and will **always stay dependency-free**. The optional dependencies in Suggests are to ensure interoperability with these packages if you are already using them.
25+
dint is implemented strictly in base R and will **always stay
26+
dependency-free**. The optional dependencies in Suggests are to ensure
27+
interoperability with these packages if you are already using them.
1628

17-
Installation
18-
------------
29+
## Installation
1930

2031
Install the release version of dint from CRAN:
2132

@@ -30,8 +41,7 @@ Or install the development version from GitHub with:
3041
devtools::install_github("s-fleck/dint")
3142
```
3243

33-
Example
34-
-------
44+
## Example
3545

3646
``` r
3747
library(dint)
@@ -85,7 +95,7 @@ last_of_quarter(q)
8595
first_of_quarter(q)
8696
#> [1] "2014-10-01"
8797
first_of_month(Sys.Date())
88-
#> [1] "2018-12-01"
98+
#> [1] "2020-01-01"
8999
first_of_isoweek(w)
90100
#> [1] "2016-12-26"
91101
last_of_isoweek(w)

cran-comments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
## resubmission
1212

13-
* fixes `\concept{\link{date_xx} subclasses}` in `date_y.Rd`
13+
* compatibility with ggplot2 >= 3.2.2

docs/404.html

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE-text.html

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)