Skip to content

Commit 3046690

Browse files
author
Stefan Fleck
committed
doc
1 parent 15f4ce4 commit 3046690

File tree

14 files changed

+201
-133
lines changed

14 files changed

+201
-133
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
man
66
inst/doc
77
docs
8+
_pkgdown.yml

NAMESPACE

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ S3method("^",date_yq)
1717
S3method(as.Date,date_y)
1818
S3method(as.Date,date_ym)
1919
S3method(as.Date,date_yq)
20+
S3method(as.POSIXct,date_xx)
2021
S3method(as.POSIXlt,date_xx)
2122
S3method(as_date_y,Date)
2223
S3method(as_date_y,default)
@@ -45,19 +46,15 @@ S3method(get_year,date_y)
4546
S3method(get_year,date_ym)
4647
S3method(get_year,date_yq)
4748
S3method(get_year,default)
48-
S3method(increment,date_ym)
49-
S3method(increment,date_yq)
5049
S3method(last_day_of_month,default)
5150
S3method(last_day_of_quarter,default)
5251
S3method(last_day_of_year,default)
5352
S3method(print,date_xx)
5453
S3method(seq,date_ym)
5554
S3method(seq,date_yq)
56-
export(as_date.date_xx)
5755
export(as_date_y)
5856
export(as_date_ym)
5957
export(as_date_yq)
60-
export(as_datetime.date_xx)
6158
export(date_y)
6259
export(date_ym)
6360
export(date_yq)
@@ -78,7 +75,6 @@ export(format_yq)
7875
export(get_month)
7976
export(get_quarter)
8077
export(get_year)
81-
export(increment)
8278
export(is_date_xx)
8379
export(is_date_y)
8480
export(is_date_ym)

R/date_xx.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ is_date_xx <- function(x){
7878

7979
# print -------------------------------------------------------------------
8080

81-
#' Title
81+
#' Print a date_xx Object
8282
#'
8383
#' @param x A [date_xx] object
8484
#' @param ... passed on to [format.date_yq()] or [format.date_ym()]

R/date_y.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' A Simple Year Date Format
1+
#' A Simple S3-Class for Years
22
#'
33
#' A simple data type for storing years. A `date_y` object is just an
44
#' integer with an additional class atribute.

R/date_ym.R

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ctor --------------------------------------------------------------------
22

3-
#' A Simple Year-Month Date Format
3+
#' A Simple S3-Class for Year-Month Dates
44
#'
55
#' A simple data type for storing year-month dates in a human readable integer
66
#' format, e.g.: December 2012 is stored as 201212. Supports simple arithmethics
@@ -117,7 +117,7 @@ as.Date.date_ym <- function(x, ...){
117117

118118
# format ------------------------------------------------------------------
119119

120-
#' Format a date_ym object
120+
#' Format a date_ym Object
121121
#'
122122
#' @param x a [date_ym] object
123123
#' @param format A scalar character, valid values are: `"iso"`, `"short"`, and
@@ -192,22 +192,7 @@ format_date_ym_shorter <- function(x){
192192

193193
# algebra -----------------------------------------------------------------
194194

195-
#' Date_ym arithmethic operations
196-
#'
197-
#' Currently only `+` and `-` are supported, all other basic arithmethic
198-
#' operations are disabled for date_ym objects.
199-
#'
200-
#' @param x a date_ym object
201-
#' @param y an integer
202-
#' @param ... passed on to methods
203-
#'
204-
#' @name date_ym_arithmetic
205-
#' @seealso [base::Arithmetic]
206-
207-
208-
209-
210-
#' @rdname date_ym_arithmetic
195+
#' @rdname date_xx_arithmetic
211196
#' @export
212197
`+.date_ym` <- function(x, y){
213198
increment(x, as.integer(y))
@@ -216,7 +201,7 @@ format_date_ym_shorter <- function(x){
216201

217202

218203

219-
#' @rdname date_ym_arithmetic
204+
#' @rdname date_xx_arithmetic
220205
#' @export
221206
`-.date_ym` <- function(x, y){
222207
increment(x, as.integer(-y))
@@ -225,7 +210,7 @@ format_date_ym_shorter <- function(x){
225210

226211

227212

228-
#' @rdname date_ym_arithmetic
213+
#' @rdname date_xx_arithmetic
229214
#' @export
230215
`*.date_ym` <- function(x, y){
231216
stop("Operation not supported")
@@ -234,7 +219,7 @@ format_date_ym_shorter <- function(x){
234219

235220

236221

237-
#' @rdname date_ym_arithmetic
222+
#' @rdname date_xx_arithmetic
238223
#' @export
239224
`/.date_ym` <- function(x, y){
240225
stop("Operation not supported")
@@ -243,7 +228,7 @@ format_date_ym_shorter <- function(x){
243228

244229

245230

246-
#' @rdname date_ym_arithmetic
231+
#' @rdname date_xx_arithmetic
247232
#' @export
248233
`^.date_ym` <- function(x, y){
249234
stop("Operation not supported")
@@ -252,7 +237,7 @@ format_date_ym_shorter <- function(x){
252237

253238

254239

255-
#' @rdname date_ym_arithmetic
240+
#' @rdname date_xx_arithmetic
256241
#' @export
257242
`%%.date_ym` <- function(x, y){
258243
stop("Operation not supported")
@@ -261,7 +246,7 @@ format_date_ym_shorter <- function(x){
261246

262247

263248

264-
#' @rdname date_ym_arithmetic
249+
#' @rdname date_xx_arithmetic
265250
#' @export
266251
`%/%.date_ym` <- function(x, y){
267252
stop("Operation not supported")
@@ -270,7 +255,7 @@ format_date_ym_shorter <- function(x){
270255

271256

272257

273-
#' @rdname date_ym_arithmetic
258+
#' @rdname date_xx_arithmetic
274259
#' @export
275260
seq.date_ym <- function(x, y, ...){
276261
res <- seq.int(as.integer(x), as.integer(y))
@@ -282,7 +267,7 @@ seq.date_ym <- function(x, y, ...){
282267

283268
# shortcuts ---------------------------------------------------------------
284269

285-
#' Conveniently produce formatted Year-Month strings
270+
#' Direclty Create Formatted Year-Month Strings
286271
#'
287272
#' @param x,m Two integer (vectors). `m` is optional and the interpretation of
288273
#' `x` will depend on whether `m` is supplied or not:

R/date_yq.R

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ctor --------------------------------------------------------------------
22

3-
#' A Simple Year-Quarter Date Format
3+
#' A Simple S3-Class for Year-Quarter Dates
44
#'
55
#' A simple data type for storing year-quarter dates in a human readable integer
66
#' format, e.g.: 3.Qurter of 2012 is stored as 20123. Supports simple arithmethics
@@ -120,7 +120,7 @@ as.Date.date_yq <- function(
120120

121121
# format ------------------------------------------------------------------
122122

123-
#' Format a date_yq object
123+
#' Format a date_yq Object
124124
#'
125125
#' @param x a [date_yq] object
126126
#' @param format A scalar character, valid values are: `"iso"`, `"short"`, and
@@ -198,17 +198,16 @@ format_date_yq_shorter <- function(x){
198198

199199
# algebra -----------------------------------------------------------------
200200

201-
#' Date_yq arithmethic operations
201+
#' Date Arithmetic Operations
202202
#'
203203
#' Currently only `+` and `-` are supported, all other basic arithmethic
204204
#' operations are disabled for date_yq objects.
205205
#'
206-
#' @param x a date_yq object
206+
#' @param x a [`date_yq`] or [`date_ym`] object
207207
#' @param y an integer
208208
#' @param ... currently ingored.
209209
#'
210-
#' @md
211-
#' @rdname date_yq_arithmetic
210+
#' @rdname date_xx_arithmetic
212211
#' @aliases date_yq_arithmetic
213212
#' @seealso [base::Arithmetic]
214213
#' @export
@@ -285,7 +284,7 @@ seq.date_yq <- function(x, y, ...){
285284

286285
# shortcuts ---------------------------------------------------------------
287286

288-
#' Conveniently produce formatted Year-Quarter strings
287+
#' Direclty Create Formatted Year-Quarter Strings
289288
#'
290289
#' @param x,q Two integer (vectors). `q` is optional and the interpretation of
291290
#' `x` will depend on whether `q` is supplied or not:

R/first_day_of_month.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
2-
3-
#' Conveniently get first/last day of month from numbers
1+
#' Get First or Last Day of Month From Year and Month
42
#'
53
#' @inheritParams format_ym
64
#' @inherit first_day_of_month
@@ -95,9 +93,7 @@ last_day_of_month.default <- function(x){
9593

9694
ifelse_simple(
9795
month < 12,
98-
make_date(get_year(x) , month + 1, 1) - 1,
96+
make_date(get_year(x), month + 1, 1) - 1,
9997
make_date(get_year(x), 12, 31)
10098
)
10199
}
102-
103-

R/first_day_of_quarter.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
2-
3-
#' Conveniently get first/last day of quarter from numbers
1+
#' Get First or Last Day of Quarter From Year and Quarter
42
#'
53
#' @inheritParams format_yq
64
#' @inherit first_day_of_quarter

R/first_day_of_year.R

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
2-
3-
#' Conveniently get first/last day of year from numbers
1+
#' Get First or Last Day of a Year
2+
#'
3+
#' `first_day_y()` is equivalent with `first_day_of_year()` and only included
4+
#' for summetry with [first_day_yq()] and [first_day_ym()].
5+
#'
46
#'
57
#' @inheritParams format_ym
68
#' @inherit first_day_of_year
79
#'
810
#' @family ym convenience functions
911
#' @seealso [first_day_of_year()]
1012
#' @export
11-
#' @md
13+
#' @rdname day_of_year
1214
#'
1315
#' @examples
14-
#'
1516
#' first_day_y(2016)
1617
#' first_day_y(2016)
17-
#'
1818
first_day_y <- function(x){
1919
first_day_of_year(date_y(x))
2020
}
2121

2222

2323

2424

25-
#' @rdname first_day_y
25+
#' @rdname day_of_year
2626
#' @export
2727
last_day_y <- function(x){
2828
last_day_of_year(date_y(x))
@@ -40,10 +40,8 @@ last_day_y <- function(x){
4040
#' @md
4141
#' @export
4242
#' @examples
43-
#'
4443
#' first_day_of_year("2016-06-04")
4544
#' last_day_of_year("2016-06-04")
46-
#'
4745
first_day_of_year <- function(x){
4846
UseMethod("first_day_of_year")
4947
}

R/get_year.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ get_year.default <- function(x){
6565

6666

6767

68-
#' Get Components of a date_xx (lubridate compat)
68+
#' Get Year, Quarter or Month (lubridate Compatibility)
6969
#'
7070
#' See [lubridate::year()] and [lubridate::month()]
7171
#'

0 commit comments

Comments
 (0)