You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/create_agegroups.R
+16-6Lines changed: 16 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -14,24 +14,31 @@
14
14
#' @param breaks_as_lower_bound Logical; if \code{TRUE} (default), breaks define the the lower bounds of the intervals (e.g., a break at 5 starts the '5-9' group).
15
15
#' If \code{FALSE}, breaks define the upper bound (e.g., a break at 5 ends the '0-5' group).
16
16
#' @param first_group_format Character string template for the first age group. Uses [glue::glue] syntax. \cr
17
-
#' The variable `x` represents the upper bound of the first interval.\cr
17
+
#' The variable `x` represents the upper bound of the first interval.
18
+
#' Ignored if the first group is collapsed using `collapse_single_year_groups`. \cr
18
19
#' Default: \code{"0-{x}"}. Other common styles: \code{"<={x}", "<{x+1}"}
19
20
#' @param interval_format Character string template for intermediate age groups. Uses [glue::glue] syntax.\cr
20
21
#' The variables `x` and `y` represent the lower and upper bounds of the interval, respectively.\cr
21
22
#' Default: \code{"{x}-{y}"}. Other common styles: \code{"{x} to {y}"}
22
23
#' @param last_group_format Character string template for the last age group. Uses [glue::glue] syntax. \cr
23
24
#' The variable `x` represents the lower bound of the last interval.\cr
24
25
#' Default: \code{"{x}+"}. Other common styles: \code{">={x}",">{x-1}"}
25
-
#' @param pad_numbers Logical or numeric; if numeric, pad numbers up to the specified length (Tip: use \code{2}).
26
+
#' @param pad_numbers Logical or numeric; if numeric, pad numbers up to the specified length
27
+
#' (`TRUE` will be treated as `2`).
26
28
#' Not compatible with calculations within glue formats. Default: \code{FALSE}
27
29
#' @param pad_with Character to use for padding numbers. Default: \code{"0"}
28
30
#' @param collapse_single_year_groups Logical; if \code{TRUE}, groups spanning a single year (e.g., from `age_breaks = c(1, 2)`)
29
31
#' are formatted as a single number (e.g., "1") instead of a range (e.g., "1-1"). Default: \code{FALSE}
30
-
#' @param na_label Label for \code{NA} values. If \code{NA}, keeps default \code{NA} handling. Default: \code{NA}
31
-
#' @param return_factor Logical; if \code{TRUE}, returns a factor, if \code{FALSE} returns character vector. Default: \code{FALSE}
32
+
#' @param na_label Label for \code{NA} values (including negative ages). If \code{NA}, keeps default \code{NA} handling. Default: \code{NA}
33
+
#' @param return_factor Logical; if \code{TRUE}, returns a factor, if \code{FALSE} returns character vector.
34
+
#' Can be used to keep the ordering and all possible levels of the age groups. Default: \code{FALSE}
32
35
#'
33
36
#' @return Vector of age group labels (character or factor depending on return_factor)
0 commit comments