% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predicates.R
\name{time_is_complete_at}
\alias{time_is_complete_at}
\title{Test whether a granule is completed at a time point}
\usage{
time_is_complete_at(x, granule, ...)
}
\arguments{
\item{x}{A time object (typically a \code{mixtime} vector).}

\item{granule}{The time granule whose precision to test, given as a granule
generator (e.g. \code{cal_gregorian$month}) or a sized time unit (e.g.
\code{cal_gregorian$month(1L)}).}

\item{...}{Additional arguments for methods.}
}
\value{
A logical vector the same length as \code{x}.
}
\description{
\code{time_is_complete_at()} tests, for each element of a \code{mixtime} vector, whether
the coarser \code{granule} that element falls into is fully observed \emph{by the vector
as a whole} -- that is, whether every finer chronon making up that granule is
present somewhere in \code{x}.
}
\details{
Unlike \code{\link[=time_is_determinate_at]{time_is_determinate_at()}}, completeness is a collective property: an
element is \code{TRUE} only when the other elements needed to fill its granule are
also present. For example, in \code{year(1L)} the months of \verb{2020 Jan : 2020 Oct}
are all \code{FALSE} (November and December are missing, so 2020 is incomplete),
whereas in \verb{2020 Jan : 2021 Mar} the twelve months of 2020 are \code{TRUE} (they
complete 2020) while the three months of 2021 remain \code{FALSE}.

A granule equal to \code{x}'s own chronon is completed by each point on its own
(\code{TRUE}). A granule finer than \code{x} cannot be completed by coarser points
(\code{FALSE}). Missing (\code{NA}) and infinite times give \code{NA}.

Completeness is only defined within a single time granularity. Mixed-type
\code{mixtime} vectors (e.g. months alongside days) are not yet supported and
raise an error.
}
\examples{
# 2020 Jan : 2020 Oct does not complete the year -> all FALSE
time_is_complete_at(yearmonth(as.Date("2020-01-01")) + 0:9, cal_gregorian$year(1L))

# 2020 Jan : 2021 Mar completes 2020 (TRUE) but not 2021 (FALSE)
time_is_complete_at(yearmonth(as.Date("2020-01-01")) + 0:14, cal_gregorian$year(1L))

}
\seealso{
\code{\link[=time_is_determinate_at]{time_is_determinate_at()}}
}
