% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ages.R
\name{ages}
\alias{ages}
\title{Split continuous ages to age groups}
\usage{
ages(x, groups, char = FALSE, below_min_val = NA)
}
\arguments{
\item{x}{Numeric array. Values of age that should be grouped}

\item{groups}{Numeric array. Values of lower boundaries of age groups}

\item{char}{Logical. Should output be numeric (\code{FALSE}) or character (\code{TRUE})? By default, \code{FALSE}}

\item{below_min_val}{What value to return for x < min(groups) when char = \code{FALSE}? Default is NA.}
}
\value{
If \code{char = TRUE}, a factor of the same length as \code{x} with age-group
labels. Otherwise, a numeric vector of the same length as \code{x} with the
lower boundaries from \code{groups}; values below the first group receive
\code{below_min_val}.
}
\description{
Split continuous ages to age groups
}
\examples{
groups <- c(0, 1, 5, 10, 15, 20, 24, 45, 85)
x <- 0:100
ages(x, groups, TRUE)

}
