mapCODs: Map CODs to strings

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/mapCODs.R

Description

Maps integer cause of death (COD) codes in COD of a SEER cancer data frame to a factor CODS with recognizable levels. This is a bit slow, so it is called within mkSEER.

Usage

1

Arguments

D

A data frame that includes COD as a column.

Value

The input data frame with an additional CODS column added on.

Note

Typing mapCODs dumps the function definition and thus the mapping used.

Author(s)

Tom Radivoyevitch (radivot@ccf.org)

See Also

SEERaBomb-package, mapRegs

Examples

1
2
library(SEERaBomb)
mapCODs # shows default definitions

Example output

Loading required package: dplyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Loading required package: ggplot2
Loading required package: rgl
Loading required package: demography
Loading required package: forecast
This is demography 1.22 

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
function (D) 
{
    COD = D$COD
    CODS = rep("other", dim(D)[1])
    CODS[COD == 41000] = NA
    CODS[COD == 0] = "alive"
    CODS[(COD >= 20010) & (COD <= 20100)] = "oral"
    CODS[COD == 21010] = "esophagus"
    CODS[COD == 21020] = "stomach"
    CODS[COD == 21030] = "intestine"
    CODS[COD == 21040] = "colon"
    CODS[COD %in% c(21050, 21060)] = "rectal"
    CODS[COD %in% c(21071, 21072)] = "liver"
    CODS[COD %in% c(21080, 21090)] = "gallBladder"
    CODS[COD == 21100] = "pancreas"
    CODS[COD %in% c(21110, 21120)] = "peritonium"
    CODS[COD == 21130] = "GI"
    CODS[COD %in% c(21110, 21120)] = "peritonium"
    CODS[COD == 22010] = "sinus"
    CODS[COD == 22020] = "larynx"
    CODS[COD == 22030] = "lung"
    CODS[COD == 22050] = "pleura"
    CODS[COD %in% c(22060, 32020)] = "thymus"
    CODS[COD == 23000] = "bone"
    CODS[COD == 24000] = "HnN"
    CODS[COD == 25010] = "melanoma"
    CODS[COD == 25020] = "skin"
    CODS[COD == 26000] = "breast"
    CODS[COD == 27010] = "cervix"
    CODS[COD %in% c(27020, 27030)] = "uterus"
    CODS[COD == 27040] = "ovary"
    CODS[COD %in% c(27050, 27060, 27070)] = "femGen"
    CODS[COD == 28010] = "prostate"
    CODS[COD == 28020] = "testes"
    CODS[COD %in% c(28030, 28040)] = "maleGen"
    CODS[COD == 29010] = "bladder"
    CODS[COD %in% c(29020, 29030, 29040)] = "renal"
    CODS[COD == 30000] = "eye"
    CODS[COD == 31010] = "brain"
    CODS[COD == 32010] = "thyroid"
    CODS[COD == 32010] = "HL"
    CODS[COD == 33040] = "NHL"
    CODS[COD == 34000] = "MM"
    CODS[COD == 35011] = "ALL"
    CODS[COD == 35012] = "CLL"
    CODS[COD %in% c(35021, 35031)] = "AML"
    CODS[COD == 35022] = "CML"
    CODS[COD %in% c(35013, 35023, 35041, 35043)] = "OL"
    CODS[COD %in% c(36010, 36020, 37000)] = "otherMalig"
    CODS[COD == 38000] = "benign"
    CODS[COD %in% c(50000, 50010, 50030, 50040)] = "infection"
    CODS[COD == 50050] = "diabetes"
    CODS[COD == 50051] = "alzheimers"
    CODS[COD == 50060] = "heart"
    CODS[COD == 50070] = "hypertension"
    CODS[COD == 50080] = "cerebroVasc"
    CODS[COD == 50090] = "athero"
    CODS[COD == 50100] = "aneurysm"
    CODS[COD == 50110] = "otherVasc"
    CODS[COD == 50120] = "pneumonia"
    CODS[COD == 50130] = "COPD"
    CODS[COD == 50140] = "ulcer"
    CODS[COD == 50150] = "livFail"
    CODS[COD == 50160] = "renFail"
    CODS[COD %in% c(50170, 50190)] = "birthing"
    CODS[COD == 50180] = "congenDef"
    CODS[COD %in% c(50200, 50300)] = "other"
    CODS[COD == 50210] = "accidents"
    CODS[COD == 50220] = "suicide"
    CODS[COD == 50230] = "homocide"
    D$CODS = as.factor(CODS)
    D
}
<environment: namespace:SEERaBomb>

SEERaBomb documentation built on Dec. 16, 2019, 1:21 a.m.