This function constructs a canreg object, which contains cancer registry data, including incidence, mortality, and population information. Users can provide either a raw regi_data data frame containing inciden and deathda columns, or supply incidence and mortality data frames directly.

as_canreg(
  regi_data = NULL,
  incidence = NULL,
  mortality = NULL,
  population = NULL,
  year = NULL,
  areacode = NULL
)

Arguments

regi_data

A data frame containing raw registry data with at least the columns:

  • inciden: date of diagnosis

  • deathda: date of death If provided, incidence and mortality will be automatically derived.

incidence

A data frame containing incidence (case) data. If not provided, it can be derived from regi_data.

mortality

A data frame containing mortality (death) data. If not provided, it can be derived from regi_data.

population

A data frame containing population data. This is required.

year

Optional numeric vector. If specified, only cases or deaths from these years will be included.

areacode

Character. The administrative area code for the data. Default is NULL.

Value

A canreg object (S3 class canreg) which is a list containing:

  • areacode: area code

  • FBcases: incidence data (S3 class FBcases)

  • SWcases: mortality data (S3 class SWcases)

  • POP: population data (S3 class POP)

Examples

if (FALSE) { # \dontrun{
# Using raw registry data
canreg_obj <- as_canreg(
  regi_data = my_registry_df,
  population = my_population_df,
  year = 2023,
  areacode = "410100"
)

# Using separate incidence and mortality data frames
canreg_obj <- as_canreg(
  incidence = my_incidence_df,
  mortality = my_mortality_df,
  population = my_population_df
)
} # }