year-day-widen: Widen: year-day

Description Usage Arguments Value Examples

Description

This is a year-day method for the calendar_widen() generic. It widens a year-day vector to the specified precision.

Usage

1
2
## S3 method for class 'clock_year_day'
calendar_widen(x, precision)

Arguments

x

[clock_year_day]

A year-day vector.

precision

[character(1)]

One of:

  • "year"

  • "day"

  • "hour"

  • "minute"

  • "second"

  • "millisecond"

  • "microsecond"

  • "nanosecond"

Value

x widened to the supplied precision.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Year precision
x <- year_day(2019)
x

# Widen to day precision
calendar_widen(x, "day")

# Or second precision
sec <- calendar_widen(x, "second")
sec

# Second precision can be widened to subsecond precision
milli <- calendar_widen(sec, "millisecond")
micro <- calendar_widen(sec, "microsecond")
milli
micro

# But once you have "locked in" a subsecond precision, it can't
# be widened again
try(calendar_widen(milli, "microsecond"))

clock documentation built on April 23, 2021, 1:06 a.m.