File: calendar-boundary.Rd

package info (click to toggle)
r-cran-clock 0.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,856 kB
  • sloc: cpp: 19,564; sh: 17; makefile: 2
file content (58 lines) | stat: -rw-r--r-- 1,619 bytes parent folder | download
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
58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/calendar.R
\name{calendar-boundary}
\alias{calendar-boundary}
\alias{calendar_start}
\alias{calendar_end}
\title{Boundaries: calendars}
\usage{
calendar_start(x, precision)

calendar_end(x, precision)
}
\arguments{
\item{x}{\verb{[calendar]}

A calendar vector.}

\item{precision}{\verb{[character(1)]}

A precision. Allowed precisions are dependent on the calendar used.}
}
\value{
\code{x} at the same precision, but with some components altered to be
at the boundary value.
}
\description{
\itemize{
\item \code{calendar_start()} computes the start of a calendar at a particular
\code{precision}, such as the "start of the quarter".
\item \code{calendar_end()} computes the end of a calendar at a particular
\code{precision}, such as the "end of the month".
}

For both \code{calendar_start()} and \code{calendar_end()}, the precision of \code{x} is
always retained.

Each calendar has its own help page describing the precisions that you
can compute a boundary at:
\itemize{
\item \link[=year-month-day-boundary]{year-month-day}
\item \link[=year-month-weekday-boundary]{year-month-weekday}
\item \link[=year-week-day-boundary]{year-week-day}
\item \link[=iso-year-week-day-boundary]{iso-year-week-day}
\item \link[=year-quarter-day-boundary]{year-quarter-day}
\item \link[=year-day-boundary]{year-day}
}
}
\examples{
# Hour precision
x <- year_month_day(2019, 2:4, 5, 6)
x

# Compute the start of the month
calendar_start(x, "month")

# Or the end of the month, notice that the hour value is adjusted as well
calendar_end(x, "month")
}