date-rounding: Date rounding

Description Usage Arguments Details Note See Also Examples

Description

Function to round dates to various units

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

Arguments

x

vector of date time objects

...

arguments passed to other functions

Details

The 'date'-ify functions round each date down to the beginning of that period using the floor_date function. This allows the continued use of date functions.

floor_X functions round to the minimum and amximum of the interval respectively. They are convenience functions for floor_date(x, unit='X').

Xify functions are synonyms for floor_X.

Functions denoted week52 normalize the number of weeks in year to 52 by pushing any days in week 53 into the 52nd week. Note, isoweek functions do not align nicely to year boundaries.

Note

TODO:

See Also

floor_date,

Examples

1
2
3
4
5
6
7
8
9
  x <- seq( ymd(20011231), ymd(20301231), "year" )
  lubridate::week(x)
  week52ify(x)
  week( week52ify(x) )

  x <- seq( ymd(20011231), ymd(20301231), "year" )
  lubridate::isoweek(x)
  isoweek52ify(x)
  isoweek( isoweek52ify(x) )

decisionpatterns/lubridate.tools documentation built on July 30, 2020, 4:24 a.m.