Learn R Programming

clock (version 0.7.1)

year-quarter-day-getters: Getters: year-quarter-day

Description

These are year-quarter-day methods for the getter generics.

  • get_year() returns the fiscal year. Note that this can differ from the Gregorian year if start != 1L.

  • get_quarter() returns the fiscal quarter as a value between 1-4.

  • get_day() returns the day of the fiscal quarter as a value between 1-92.

  • There are sub-daily getters for extracting more precise components.

Usage

# S3 method for clock_year_quarter_day
get_year(x)

# S3 method for clock_year_quarter_day get_quarter(x)

# S3 method for clock_year_quarter_day get_day(x)

# S3 method for clock_year_quarter_day get_hour(x)

# S3 method for clock_year_quarter_day get_minute(x)

# S3 method for clock_year_quarter_day get_second(x)

# S3 method for clock_year_quarter_day get_millisecond(x)

# S3 method for clock_year_quarter_day get_microsecond(x)

# S3 method for clock_year_quarter_day get_nanosecond(x)

Value

The component.

Arguments

x

[clock_year_quarter_day]

A year-quarter-day to get the component from.

Examples

Run this code
x <- year_quarter_day(2020, 1:4)

get_quarter(x)

# Set and then get the last day of the quarter
x <- set_day(x, "last")
get_day(x)

# Start the fiscal year in November and choose the 50th day in
# each quarter of 2020
november <- 11
y <- year_quarter_day(2020, 1:4, 50, start = 11)
y

get_day(y)

# What does that map to in year-month-day?
as_year_month_day(y)

Run the code above in your browser using DataLab