% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/linear_time.R
\name{linear_time}
\alias{linear_time}
\title{Linear time points}
\usage{
linear_time(
  data,
  chronon = time_chronon(data),
  discrete = TRUE,
  calendar = time_calendar(data)
)
}
\arguments{
\item{data}{Input data to convert to linear time. Can be:
\itemize{
\item Numeric values (interpreted as chronons since Unix epoch)
\item Character strings (parsed as dates/times)
\item Date or POSIXct objects
\item Other time objects
}}

\item{chronon}{A time granule expression representing the chronon (smallest
indivisible time granule), evaluated in the context of \code{calendar}. Use
unquoted expressions like \code{month(1L)} or \code{hour(1L)}. Chronons from a
specific calendar can also be used (e.g. \code{cal_isoweek$week(1L)}).
Defaults to the time chronon of the input \code{data} (\code{time_chronon(data)}).}

\item{discrete}{Logical. If \code{TRUE} (default), returns integer chronons since
Unix epoch (discrete time model). If \code{FALSE}, returns fractional chronons
allowing representation of fractional time granules (continuous time model).}

\item{calendar}{Calendar system used to evaluate \code{chronon} and \code{granules}.
Defaults to \code{time_calendar(data)} for existing time objects. Common options
include \link{cal_gregorian} and \link{cal_isoweek}.}
}
\value{
A \code{mixtime} time vector containing an \code{mt_linear} vector.
}
\description{
\code{linear_time()} creates a vector of linear time points with a specified
chronon (smallest time granule). This function is useful for creating custom
time representations that aren't covered by the convenience functions like
\code{\link[=yearmonth]{yearmonth()}} or \code{\link[=yearweek]{yearweek()}}.
}
\examples{
# Hourly time
linear_time(
  Sys.time(),
  chronon = hour(1L)
)

# Monthly time
linear_time(
  Sys.Date(),
  chronon = month(1L)
)

# Discrete vs continuous time
linear_time(Sys.time(), chronon = day(1L), discrete = TRUE)
linear_time(Sys.time(), chronon = day(1L), discrete = FALSE)

# ISO week calendar with week-day structure
linear_time(
  Sys.Date(),
  chronon = day(1L),
  calendar = cal_isoweek
)

}
\seealso{
\itemize{
\item \code{\link[=new_linear_time_fn]{new_linear_time_fn()}} for creating reusable linear time functions
\item \code{\link[=yearmonth]{yearmonth()}}, \code{\link[=yearquarter]{yearquarter()}}, \code{\link[=year]{year()}} for Gregorian time representations
\item \code{\link[=yearweek]{yearweek()}} for ISO 8601 week-based time
\item \link{cal_gregorian}, \link{cal_isoweek} for calendar systems
}
}
