Chapter 41 11. Categorize cancer type and age group
Cancer categories used in this practice:
| Category | ICD-10 code(s) | Description |
|---|---|---|
| 1 | C50 | Breast cancer |
| 2 | C61 | Prostate cancer |
| 3 | C33, C34 | Lung cancer |
| 4 | C18-C21 | Colorectal cancer |
| 5 | All other C codes | Other cancers |
rates <- rates %>%
mutate(
CauseCat = case_when(
number == 50 ~ 1,
number == 61 ~ 2,
number %in% c(33, 34) ~ 3,
number %in% 18:21 ~ 4,
TRUE ~ 5
),
CauseCat_label = case_when(
CauseCat == 1 ~ "Breast cancer",
CauseCat == 2 ~ "Prostate cancer",
CauseCat == 3 ~ "Lung cancer",
CauseCat == 4 ~ "Colorectal cancer",
CauseCat == 5 ~ "Other cancer"
),
AgeCat = cut(
Age,
breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 130),
include.lowest = TRUE,
right = FALSE
)
)
rates %>% count(CauseCat_label)## # A tibble: 5 x 2
## CauseCat_label n
## <chr> <int>
## 1 Breast cancer 4003
## 2 Colorectal cancer 6564
## 3 Lung cancer 14914
## 4 Other cancer 30328
## 5 Prostate cancer 3107
## # A tibble: 10 x 2
## AgeCat n
## <fct> <int>
## 1 [0,10) 66
## 2 [10,20) 81
## 3 [20,30) 148
## 4 [30,40) 459
## 5 [40,50) 1522
## 6 [50,60) 5867
## 7 [60,70) 13086
## 8 [70,80) 16498
## 9 [80,90) 15521
## 10 [90,130] 5668