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 59
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gregorian-year-day.R
\name{year-day-narrow}
\alias{year-day-narrow}
\alias{calendar_narrow.clock_year_day}
\title{Narrow: year-day}
\usage{
\method{calendar_narrow}{clock_year_day}(x, precision)
}
\arguments{
\item{x}{\verb{[clock_year_day]}
A year-day vector.}
\item{precision}{\verb{[character(1)]}
One of:
\itemize{
\item \code{"year"}
\item \code{"day"}
\item \code{"hour"}
\item \code{"minute"}
\item \code{"second"}
\item \code{"millisecond"}
\item \code{"microsecond"}
\item \code{"nanosecond"}
}}
}
\value{
\code{x} narrowed to the supplied \code{precision}.
}
\description{
This is a year-day method for the \code{\link[=calendar_narrow]{calendar_narrow()}} generic. It
narrows a year-day vector to the specified \code{precision}.
}
\examples{
# Hour precision
x <- year_day(2019, 3, 4)
x
# Narrowed to day precision
calendar_narrow(x, "day")
# Or year precision
calendar_narrow(x, "year")
# Subsecond precision can be narrowed to second precision
milli <- calendar_widen(x, "millisecond")
micro <- calendar_widen(x, "microsecond")
milli
micro
calendar_narrow(milli, "second")
calendar_narrow(micro, "second")
# But once you have "locked in" a subsecond precision, it can't be
# narrowed to another subsecond precision
try(calendar_narrow(micro, "millisecond"))
}
|