Skip to contents

A matrix that knows about its age breaks - which are by default provided as its rownames. Mostly intended for internal use.

Usage

new_age_matrix(matrix, age_breaks)

Arguments

matrix

numeric matrix

age_breaks

character vector of age breaks, by default the rownames.

Value

matrix with age breaks attribute

Examples

age_break_names <- c("[0,5)", "[5,10)", "[10, 15)")
age_mat <- matrix(
  runif(9),
  nrow = 3,
  ncol = 3,
  dimnames = list(
    age_break_names,
    age_break_names
  )
)

new_age_matrix(
  age_mat,
  age_breaks = age_break_names
)
#>               [0,5)    [5,10)  [10, 15)
#> [0,5)    0.78360108 0.1342332 0.1163423
#> [5,10)   0.09236553 0.1037733 0.3765886
#> [10, 15) 0.09334828 0.8368064 0.3942739