age_grouper {grattan}R Documentation

Age grouper

Description

Age grouper

Usage

age_grouper(
  age,
  interval = 10,
  min_age = 25,
  max_age = 75,
  breaks = NULL,
  labels = NULL,
  below = "Below\n",
  exp_min_age = 1L,
  exp_max_age = 100L,
  threshold = 10000L
)

Arguments

age

A numeric age (in years).

interval

How big should the age range be. 25-34 means interval = 10.

min_age

What is the upper bound of the lowest bracket? (min_age = 25 means 'Under 25' will be the lowest bracket.)

max_age

What is the lower bound of the highest bracket? (max_age = 75 means '75+' will be the bracket.)

breaks

Specify breaks manually.

labels

Specify the labels manually.

below

String giving the prefix for the lowest bin. (Only applicable if breaks and labels are NULL.)

exp_min_age, exp_max_age

Integers specifying the lowest/highest expected age in age. If any values fall outside this range, ages will still work though perhaps slow when length(age) >> threshold.

threshold

An integer, the minimum length at which the calculation will be accelerated.

Value

An ordered factor giving age ranges (separated by hyphens) as specified.

Examples

age_grouper(42)
age_grouper(42, interval = 5, min_age = 20, max_age = 60)

[Package grattan version 2024.1.1 Index]