Searches for specific ICD-O-3 (International Classification of Diseases for Oncology, 3rd edition) codes in Swedish cancer registry data and adds corresponding boolean variables to the skeleton. ICD-O-3 is used to classify malignant neoplasms (cancers) by histological type (morphology) and anatomical site (topography).
Usage
add_icdo3s(skeleton, dataset, id_name, codes = list(), icdo3s = NULL)Arguments
- skeleton
A data.table containing the main skeleton structure created by
create_skeleton- dataset
A data.table containing cancer registry data with ICD-O-3 codes. Must have columns for person ID, date variables, and ICD-O-3 code column (icdo3)
- id_name
Character string specifying the name of the ID variable in the dataset
- codes
Named list of ICD-O-3 code patterns to search for. Names become variable names in skeleton.
- icdo3s
Deprecated. Use
codesinstead. ICD-O-3 codes combine morphology (4 digits + behavior code) and topography (C codes). Examples of pattern matching:"^8140"- Adenocarcinoma, NOS (morphology code)"^C50"- Breast cancer (topography code)"8500/3"- Infiltrating duct carcinoma (morphology with behavior)
Value
The skeleton data.table is modified by reference with ICD-O-3 variables added. New boolean variables are created for each ICD-O-3 pattern, TRUE when code is present.
See also
create_skeleton for creating the skeleton structure,
add_diagnoses for ICD-10 diagnosis codes,
add_operations for surgical procedure codes,
make_lowercase_names for data preprocessing
Other data_integration:
add_annual(),
add_cods(),
add_diagnoses(),
add_onetime(),
add_operations(),
add_rx(),
add_snomed3s(),
add_snomedo10s()
Examples
# Load fake data
data("fake_person_ids", package = "swereg")
data("fake_diagnoses", package = "swereg")
swereg::make_lowercase_names(fake_diagnoses, date_columns = "indatum")
#> Found additional date columns not in date_columns: utdatum. Consider adding them for automatic date parsing.
# Create skeleton
skeleton <- create_skeleton(fake_person_ids[1:10], "2020-01-01", "2020-12-31")
# Add ICD-O-3 codes for specific cancer types
cancer_codes <- list(
"adenocarcinoma" = c("^8140"),
"breast_cancer" = c("^C50")
)
add_icdo3s(skeleton, fake_diagnoses, "lopnr", cancer_codes)
