% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/yearquarter.R
\name{yearquarter}
\alias{yearquarter}
\alias{make_yearquarter}
\alias{is_yearquarter}
\alias{fiscal_year}
\title{Represent year-quarter}
\usage{
yearquarter(x, fiscal_start = 1)

make_yearquarter(year = 1970L, quarter = 1L, fiscal_start = 1)

is_yearquarter(x)

fiscal_year(x)
}
\arguments{
\item{x}{Other object.}

\item{fiscal_start}{numeric indicating the starting month of a fiscal year.}

\item{year, quarter}{A vector of numerics give years and quarters.}
}
\value{
year-quarter (\code{yearquarter}) objects.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}

Create or coerce using \code{yearquarter()}.
}
\section{Display}{

Use \code{format()} to display \code{yearweek}, \code{yearmonth}, and \code{yearquarter} objects
in required formats.
Please see \code{\link[=strptime]{strptime()}} details for supported conversion specifications.
}

\examples{
# coerce POSIXct/Dates to yearquarter
x <- seq(as.Date("2016-01-01"), as.Date("2016-12-31"), by = "1 quarter")
yearquarter(x)
yearquarter(x, fiscal_start = 6)

# parse characters
yearquarter(c("2018 Q1", "2018 Qtr1", "2018 Quarter 1"))

# seq() and arithmetic
qtr <- yearquarter("2017 Q1")
seq(qtr, length.out = 10, by = 1) # by 1 quarter
qtr + 0:9

# display formats
format(qtr, format = "\%y Qtr\%q")

make_yearquarter(year = 2021, quarter = 2:3)
make_yearquarter(year = 2020:2021, quarter = 2:3)

# `fiscal_year()` helps to extract fiscal year
y <- yearquarter(as.Date("2020-06-01"), fiscal_start = 6)
fiscal_year(y)
lubridate::year(y) # calendar years
}
\seealso{
\link{scale_x_yearquarter} and others for ggplot2 scales

Other index functions: 
\code{\link{yearmonth}()},
\code{\link{yearweek}()}
}
\concept{index functions}
