Converts ICD-O-3 topography codes in to a numeric format. It removes the "C" from the beginning of the string if present, and ensures that the codes are valid ICD-O-3 site codes.

site_convert(x, validate = TRUE)

Arguments

x

The ICD-O-3 site codes to be converted.

validate

Logical indicating whether to make the converted values have valid ICD-O-3 sites codes between C00.0 and C97.0, setting any invalid codes to NA. Default value is TRUE.

Value

Returns a converted ICD-O-3 topography code in a numeric format.

Details

Takes in a character or numeric vector of ICD-O-3 site codes and converts them to a standardized numeric format. The function will remove the "C" from the beginning of the string if present. It will also automatically detect if the codes have are in decimal ("C34.1") or integer ("C341") format and convert them.

If validate is set to TRUE, the function checks if the topography codes are valid ICD-O-3 site codes for neoplasms which range from C00.0 to C97.0. Any invalid codes will be set to NA and a warning will be issued indicating the number of invalid codes found.

Examples

# Character input with and without "C" at the beginning
site_convert(c("C80.1", "C34.1", "C50.3", "C424", "80.9"))
#> [1] 801 341 503 424 809

# Numeric input
site_convert(c(80.1, 8.1, 81, 708)) # Numeric input
#> [1] 801  81 810 708