year_quarter_day {clock} R Documentation

## Calendar: year-quarter-day

### Description

year_quarter_day() constructs a calendar from the fiscal year, fiscal quarter, and day of the quarter, along with a value determining which month the fiscal year starts in.

### Usage

year_quarter_day(
year,
quarter = NULL,
day = NULL,
hour = NULL,
minute = NULL,
second = NULL,
subsecond = NULL,
...,
start = NULL,
subsecond_precision = NULL
)


### Arguments

 year ⁠[integer]⁠ The fiscal year. Values ⁠[-32767, 32767]⁠ are generally allowed. quarter ⁠[integer / NULL]⁠ The fiscal quarter. Values ⁠[1, 4]⁠ are allowed. day ⁠[integer / "last" / NULL]⁠ The day of the quarter. Values ⁠[1, 92]⁠ are allowed. If "last", the last day of the quarter is returned. hour ⁠[integer / NULL]⁠ The hour. Values ⁠[0, 23]⁠ are allowed. minute ⁠[integer / NULL]⁠ The minute. Values ⁠[0, 59]⁠ are allowed. second ⁠[integer / NULL]⁠ The second. Values ⁠[0, 59]⁠ are allowed. subsecond ⁠[integer / NULL]⁠ The subsecond. If specified, subsecond_precision must also be specified to determine how to interpret the subsecond. If using milliseconds, values ⁠[0, 999]⁠ are allowed. If using microseconds, values ⁠[0, 999999]⁠ are allowed. If using nanoseconds, values ⁠[0, 999999999]⁠ are allowed. ... These dots are for future extensions and must be empty. start ⁠[integer(1) / NULL]⁠ The month to start the fiscal year in. 1 = January and 12 = December. If NULL, a start of January will be used. subsecond_precision ⁠[character(1) / NULL]⁠ The precision to interpret subsecond as. One of: "millisecond", "microsecond", or "nanosecond".

### Details

Fields are recycled against each other using tidyverse recycling rules.

Fields are collected in order until the first NULL field is located. No fields after the first NULL field are used.

### Value

A year-quarter-day calendar vector.

### Examples

# Year-quarter type
x <- year_quarter_day(2019, 1:4)
x

# Set the day to the last day of the quarter
x <- set_day(x, "last")
x

# Start the fiscal year in June
june <- 6L
y <- year_quarter_day(2019, 1:4, "last", start = june)

# Compare the year-month-day values that result from having different
# fiscal year start months
as_year_month_day(x)
as_year_month_day(y)


[Package clock version 0.7.0 Index]