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
)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.
A data frame containing incidence (case) data. If not provided,
it can be derived from regi_data.
A data frame containing mortality (death) data. If not provided,
it can be derived from regi_data.
A data frame containing population data. This is required.
Optional numeric vector. If specified, only cases or deaths from these years will be included.
Character. A registry or area identifier for the data.
It is stored as a character vector and is not limited to administrative
division codes. Default is NULL.
A canreg object (S3 class canreg) which is a list containing:
areacode: registry or area identifier
FBcases: incidence data (S3 class FBcases)
SWcases: mortality data (S3 class SWcases)
POP: population data (S3 class POP)
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
)
} # }