add age time bin

add_age_bin(
  data_source,
  age_var_name = "age",
  bin_var_name = "BIN",
  bin_size = 1000,
  sel_method = c("backward", "forward")
)

Arguments

data_source

Data frame with age represented by age_var_name variable.

age_var_name

Character. Name of the column with age.

bin_var_name

Character. Name of the new colun with binned ages.

bin_size

Numeric. Size of the time bin.

sel_method

Character. Which direction should the values be binned.

  • "backward" - c(59, 105) -> c(0, 100)

  • "forward" - c(59, 105) -> c(100, 200)