Reads cancer registry data from one or more Excel files or from
a directory containing Excel files. It extracts case and population data and
returns objects of class "canreg" or a list of such objects ("canregs").
read_canreg(
x,
pop_type = "long",
age_var = "agegroup",
pop_var = "popu",
death_var = "death"
)A path to an Excel file, a character vector of file paths, or a directory containing Excel files.
A character string specifying the format of the population
sheet. Must be either "long" (default) or "wide".
Name of the age group column (used only when
pop_type = "long"). Default is "agegroup".
Name of the population count column (used only when
pop_type = "long"). Default is "popu".
Name of the death count column (used only when
pop_type = "long"). If not present in the sheet, a column with 0s will
be added. Default is "death".
A canreg object (a list with components: areacode, FBcases,
SWcases, POP) if a single file is read. A named list of such objects
with class "canregs" if multiple files or a directory is provided.
if (FALSE) { # \dontrun{
file_address <- "410302.xlsx"
canreg <- read_canreg(file_address, pop_type = "long")
} # }