% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cyclical_time.R
\name{new_cyclical_time_fn}
\alias{new_cyclical_time_fn}
\title{Cyclical time function factory}
\usage{
new_cyclical_time_fn(chronon, cycle, default_calendar = cal_gregorian)
}
\arguments{
\item{chronon}{A time granule object representing the chronon (e.g., \code{day(1L)})}

\item{cycle}{A time granule object representing the cycle (e.g., \code{week(1L)})}

\item{default_calendar}{A default calendar used to find the time units for
conversion if they don't exist in the calendar of the input data (e.g., \code{cal_isoweek})}
}
\value{
A function used to create cyclical time points with a specific chronon and cycle.
}
\description{
\code{new_cyclical_time_fn()} creates a cyclical time function for a specified
chronon and cycle. The cycle is the larger time granule that defines the time
period over which the chronon loops (e.g., a week). The chronon is the smaller
time granule that iterates within each cycle (e.g., a day). Combined, these two
granules form a cyclical time relationship (e.g., day of the week).
}
\examples{

day_of_week <- new_cyclical_time_fn(day(1L), week(1L), default_calendar = cal_isoweek)
day_of_week(Sys.Date())

month_of_year <- new_cyclical_time_fn(month(1L), year(1L))
month_of_year(Sys.Date())

}
