Skip to content

Commit 839c90f

Browse files
committed
docs: move get_interval_duration to own page
1 parent 5056b56 commit 839c90f

8 files changed

Lines changed: 197 additions & 121 deletions

File tree

docs/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
2-
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
2+
<html lang="en">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
6-
<meta name="generator" content="litedown 0.9.2.1">
6+
<meta name="generator" content="litedown 0.9.3">
77
<title>grates</title>
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/default.min.css">
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/article.min.css">
@@ -30,7 +30,7 @@
3030
</tr>
3131
<tr>
3232
<td>Version</td>
33-
<td>1.7.2</td>
33+
<td>1.7.2.9000</td>
3434
</tr>
3535
<tr>
3636
<td>Description</td>
@@ -85,7 +85,7 @@
8585
</div>
8686
<footer><div class="flex-col">
8787
<p>Developed by Tim Taylor</p>
88-
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.2.1</p>
88+
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.3</p>
8989
</div></footer>
9090
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/sidenotes.min.js" defer></script>
9191
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/appendix.min.js" defer></script>

docs/manual.html

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
2-
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
2+
<html lang="en">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
6-
<meta name="generator" content="litedown 0.9.2.1">
6+
<meta name="generator" content="litedown 0.9.3">
77
<title>Help pages</title>
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/default.min.css">
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/article.min.css">
@@ -164,6 +164,17 @@
164164
<a href="#sec:man-grouped_date_accessors"><code>get_offset()</code></a>
165165
<a href="#sec:man-grouped_date_accessors"><code>get_offset.default()</code></a>
166166
<a href="#sec:man-grouped_date_accessors"><code>get_offset.grates_period()</code></a>
167+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration()</code></a>
168+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.default()</code></a>
169+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_yearweek()</code></a>
170+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_int_period()</code></a>
171+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_isoweek()</code></a>
172+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_epiweek()</code></a>
173+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_yearmonth()</code></a>
174+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_month()</code></a>
175+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_yearquarter()</code></a>
176+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_year()</code></a>
177+
<a href="#sec:man-grouped_date_accessors"><code>get_interval_duration.grates_period()</code></a>
167178
</p>
168179
<p>
169180
<b>-- <kbd>I</kbd> --</b>
@@ -392,7 +403,7 @@ <h3 id="sec:examples_2" class="unnumbered unlisted">Examples</h3>
392403
as_epiweek(Sys.Date())
393404
</code></pre>
394405
<pre><code>#&gt; &lt;grates_epiweek[1]&gt;
395-
#&gt; [1] &quot;2026-W08&quot;
406+
#&gt; [1] &quot;2026-W12&quot;
396407
</code></pre>
397408
<pre><code class="language-r"># POSIXt coercion
398409
as_epiweek(as.POSIXct(&quot;2019-03-04 01:01:01&quot;, tz = &quot;America/New_York&quot;))
@@ -545,7 +556,39 @@ <h3 id="sec:usage_4" class="unnumbered unlisted">Usage</h3>
545556
get_offset(x, ...)
546557

547558
## S3 method for class 'grates_period'
548-
get_offset(x, ...)</code></pre>
559+
get_offset(x, ...)
560+
561+
get_interval_duration(x, ...)
562+
563+
## Default S3 method:
564+
get_interval_duration(x, ...)
565+
566+
## S3 method for class 'grates_yearweek'
567+
get_interval_duration(x, ...)
568+
569+
## S3 method for class 'grates_int_period'
570+
get_interval_duration(x, ...)
571+
572+
## S3 method for class 'grates_isoweek'
573+
get_interval_duration(x, ...)
574+
575+
## S3 method for class 'grates_epiweek'
576+
get_interval_duration(x, ...)
577+
578+
## S3 method for class 'grates_yearmonth'
579+
get_interval_duration(x, ...)
580+
581+
## S3 method for class 'grates_month'
582+
get_interval_duration(x, ...)
583+
584+
## S3 method for class 'grates_yearquarter'
585+
get_interval_duration(x, ...)
586+
587+
## S3 method for class 'grates_year'
588+
get_interval_duration(x, ...)
589+
590+
## S3 method for class 'grates_period'
591+
get_interval_duration(x, ...)</code></pre>
549592
<h3 id="sec:arguments_4" class="unnumbered unlisted">Arguments</h3>
550593
<table role = "presentation">
551594
<tr><td><code>x</code></td>
@@ -765,7 +808,7 @@ <h3 id="sec:examples_6" class="unnumbered unlisted">Examples</h3>
765808
as_isoweek(Sys.Date())
766809
</code></pre>
767810
<pre><code>#&gt; &lt;grates_isoweek[1]&gt;
768-
#&gt; [1] &quot;2026-W09&quot;
811+
#&gt; [1] &quot;2026-W13&quot;
769812
</code></pre>
770813
<pre><code class="language-r"># POSIXt coercion
771814
as_isoweek(as.POSIXct(&quot;2019-03-04 01:01:01&quot;, tz = &quot;America/New_York&quot;))
@@ -880,7 +923,7 @@ <h3 id="sec:examples_7" class="unnumbered unlisted">Examples</h3>
880923
as_month(Sys.Date(), n = 2)
881924
</code></pre>
882925
<pre><code>#&gt; &lt;grates_month[1]&gt;
883-
#&gt; [1] &quot;2026-Jan to 2026-Feb&quot;
926+
#&gt; [1] &quot;2026-Mar to 2026-Apr&quot;
884927
</code></pre>
885928
<pre><code class="language-r"># character coercion
886929
as_month(&quot;2019-05-03&quot;, n = 4)
@@ -2000,7 +2043,7 @@ <h3 id="sec:examples_17" class="unnumbered unlisted">Examples</h3>
20002043
as_yearmonth(Sys.Date())
20012044
</code></pre>
20022045
<pre><code>#&gt; &lt;grates_yearmonth[1]&gt;
2003-
#&gt; [1] &quot;2026-Feb&quot;
2046+
#&gt; [1] &quot;2026-Mar&quot;
20042047
</code></pre>
20052048
<pre><code class="language-r"># POSIXt coercion
20062049
as_yearmonth(as.POSIXct(&quot;2019-03-04 01:01:01&quot;, tz = &quot;America/New_York&quot;))
@@ -2283,7 +2326,7 @@ <h3 id="sec:examples_19" class="unnumbered unlisted">Examples</h3>
22832326
as_yearweek(Sys.Date())
22842327
</code></pre>
22852328
<pre><code>#&gt; &lt;grates_yearweek_monday[1]&gt;
2286-
#&gt; [1] &quot;2026-W09&quot;
2329+
#&gt; [1] &quot;2026-W13&quot;
22872330
</code></pre>
22882331
<pre><code class="language-r"># POSIXt coercion
22892332
as_yearweek(as.POSIXct(&quot;2019-03-04 01:01:01&quot;, tz = &quot;America/New_York&quot;))
@@ -2321,7 +2364,7 @@ <h3 id="sec:examples_19" class="unnumbered unlisted">Examples</h3>
23212364
</div>
23222365
<footer><div class="flex-col">
23232366
<p>Developed by Tim Taylor</p>
2324-
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.2.1</p>
2367+
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.3</p>
23252368
</div></footer>
23262369
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/sidenotes.min.js" defer></script>
23272370
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/appendix.min.js" defer></script>

docs/news.html

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
2-
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
2+
<html lang="en">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
6-
<meta name="generator" content="litedown 0.9.2.1">
6+
<meta name="generator" content="litedown 0.9.3">
77
<title>News</title>
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/default.min.css">
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/article.min.css">
@@ -24,17 +24,22 @@
2424
<div class="body">
2525
<div id="TOC">
2626
<ul>
27+
<li><a href="#sec:grates-development-version">grates (development version)</a>
28+
<ul>
29+
<li><a href="#sec:breaking-change_1">breaking change</a></li>
30+
</ul>
31+
</li>
2732
<li><a href="#sec:grates-1-7-2">grates 1.7.2</a></li>
2833
<li><a href="#sec:grates-1-7-1">grates 1.7.1</a></li>
2934
<li><a href="#sec:grates-1-7-0">grates 1.7.0</a></li>
3035
<li><a href="#sec:grates-1-6-0">grates 1.6.0</a>
3136
<ul>
32-
<li><a href="#sec:breaking-change_1">breaking change</a></li>
37+
<li><a href="#sec:breaking-change_2">breaking change</a></li>
3338
</ul>
3439
</li>
3540
<li><a href="#sec:grates-1-5-0">grates 1.5.0</a>
3641
<ul>
37-
<li><a href="#sec:breaking-change_2">breaking change</a></li>
42+
<li><a href="#sec:breaking-change_3">breaking change</a></li>
3843
<li><a href="#sec:internal-changes">Internal changes</a></li>
3944
</ul>
4045
</li>
@@ -73,6 +78,25 @@
7378
<li><a href="#sec:grates-0-1-1">grates 0.1.1</a></li>
7479
</ul>
7580
</div>
81+
<h2 id="sec:grates-development-version" class="unnumbered">grates (development version)</h2>
82+
<ul>
83+
<li>
84+
<p>New function <code>get_interval_duration()</code> which returns the number of days
85+
covered by an element of a grates object, e.g. the following is TRUE</p>
86+
<pre><code>identical(
87+
get_interval_duration(yearmonth(2020, 1:3)),
88+
c(31, 29, 31)
89+
)
90+
</code></pre>
91+
</li>
92+
</ul>
93+
<h3 id="sec:breaking-change_1" class="unnumbered">breaking change</h3>
94+
<ul>
95+
<li><code>as.double()</code> for <code>&lt;grates_int_period&gt;</code> objects now returns the same result
96+
(subject to type) as <code>as.integer()</code>. Both return the lower bound of related
97+
interval. Note that <code>&lt;grates_int_period&gt;</code> objects should still be treated
98+
as experimental for the time being.</li>
99+
</ul>
76100
<h2 id="sec:grates-1-7-2" class="unnumbered">grates 1.7.2</h2>
77101
<ul>
78102
<li>Small updates to the vignette’s css and js.</li>
@@ -94,7 +118,7 @@ <h2 id="sec:grates-1-7-0" class="unnumbered">grates 1.7.0</h2>
94118
</li>
95119
</ul>
96120
<h2 id="sec:grates-1-6-0" class="unnumbered">grates 1.6.0</h2>
97-
<h3 id="sec:breaking-change_1" class="unnumbered">breaking change</h3>
121+
<h3 id="sec:breaking-change_2" class="unnumbered">breaking change</h3>
98122
<ul>
99123
<li>
100124
<p>The default <code>offset</code> argument for the Date and POSIXt methods of the
@@ -108,7 +132,7 @@ <h3 id="sec:breaking-change_1" class="unnumbered">breaking change</h3>
108132
</li>
109133
</ul>
110134
<h2 id="sec:grates-1-5-0" class="unnumbered">grates 1.5.0</h2>
111-
<h3 id="sec:breaking-change_2" class="unnumbered">breaking change</h3>
135+
<h3 id="sec:breaking-change_3" class="unnumbered">breaking change</h3>
112136
<ul>
113137
<li><code>is.numeric()</code> now returns <code>FALSE</code> for all grates objects. This makes the
114138
underlying implementation more opaque to end users and feels more consistent
@@ -305,7 +329,7 @@ <h2 id="sec:grates-0-1-1" class="unnumbered">grates 0.1.1</h2>
305329
</div>
306330
<footer><div class="flex-col">
307331
<p>Developed by Tim Taylor</p>
308-
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.2.1</p>
332+
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.3</p>
309333
</div></footer>
310334
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/sidenotes.min.js" defer></script>
311335
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/appendix.min.js" defer></script>

docs/vignette.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
2-
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
2+
<html lang="en">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
6-
<meta name="generator" content="litedown 0.9.2.1">
6+
<meta name="generator" content="litedown 0.9.3">
77
<title>Grouped dates</title>
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/default.min.css">
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/css/article.min.css">
@@ -468,7 +468,7 @@ <h2 id="sec:acknowledgements">Acknowledgements</h2>
468468
</div>
469469
<footer><div class="flex-col">
470470
<p>Developed by Tim Taylor</p>
471-
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.2.1</p>
471+
<p>Site built with <a href="https://github.com/yihui/litedown">litedown</a> v0.9.3</p>
472472
</div></footer>
473473
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/sidenotes.min.js" defer></script>
474474
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils@1.14.24/js/appendix.min.js" defer></script>

pkg/R/accessors.R

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -207,68 +207,3 @@ get_offset.default <- function(x, ...) {
207207
get_offset.grates_period <- function(x, ...) {
208208
attr(x, "offset")
209209
}
210-
211-
# -------------------------------------------------------------------------
212-
#' @name grouped_date_accessors
213-
#' @export
214-
get_interval_duration <- function(x, ...) {
215-
UseMethod("get_interval_duration")
216-
}
217-
218-
# -------------------------------------------------------------------------
219-
#' @rdname grouped_date_accessors
220-
#' @export
221-
get_interval_duration.default <- function(x, ...) {
222-
stopf("Not implemented for class [%s].", toString(class(x)))
223-
}
224-
225-
# -------------------------------------------------------------------------
226-
#' @rdname grouped_date_accessors
227-
#' @export
228-
get_interval_duration.grates_yearweek <- function(x, ...) {
229-
rep(7, length(x))
230-
}
231-
232-
# -------------------------------------------------------------------------
233-
#' @rdname grouped_date_accessors
234-
#' @export
235-
get_interval_duration.grates_int_period <- function(x, ...) {
236-
rep(attr(x, "n"), length(x))
237-
}
238-
239-
# -------------------------------------------------------------------------
240-
#' @rdname grouped_date_accessors
241-
#' @export
242-
get_interval_duration.grates_isoweek <- get_interval_duration.grates_yearweek
243-
244-
# -------------------------------------------------------------------------
245-
#' @rdname grouped_date_accessors
246-
#' @export
247-
get_interval_duration.grates_epiweek <- get_interval_duration.grates_yearweek
248-
249-
# -------------------------------------------------------------------------
250-
#' @rdname grouped_date_accessors
251-
#' @export
252-
get_interval_duration.grates_yearmonth <- function(x, ...) {
253-
as.double(as.Date(x + 1) - as.Date(x), units = "days")
254-
}
255-
256-
# -------------------------------------------------------------------------
257-
#' @rdname grouped_date_accessors
258-
#' @export
259-
get_interval_duration.grates_month <- get_interval_duration.grates_yearmonth
260-
261-
# -------------------------------------------------------------------------
262-
#' @rdname grouped_date_accessors
263-
#' @export
264-
get_interval_duration.grates_yearquarter <- get_interval_duration.grates_yearmonth
265-
266-
# -------------------------------------------------------------------------
267-
#' @rdname grouped_date_accessors
268-
#' @export
269-
get_interval_duration.grates_year <- get_interval_duration.grates_yearmonth
270-
271-
# -------------------------------------------------------------------------
272-
#' @rdname grouped_date_accessors
273-
#' @export
274-
get_interval_duration.grates_period <- get_interval_duration.grates_int_period

0 commit comments

Comments
 (0)