naaccr_factor: Replace NAACCR codes with understandable factors

Description Usage Arguments Value Examples

View source: R/naaccr_factor.R

Description

Replace NAACCR codes with understandable factors

Usage

1

Arguments

x

Vector (usually character) of codes.

field

String giving the XML name of the NAACCR field to code.

keep_unknown

Logical indicating whether values of "unknown" should be a level in the factor or NA.

...

Additional arguments passed onto factor.

Value

A factor vector version of x. The levels are short descriptions instead of the basic NAACCR codes. Codes which stood for "unknown" with no further information are replaced with NA.

If field names a text or site-specific field, x will be returned unchanged with a warning.

Examples

1
2
3
4
5
  naaccr_factor(c("20", "43", "99"), "radRegionalRxModality")
  naaccr_factor(c("USA", "GER", "XEN"), "addrAtDxCountry")
  # Default: NA for unknowns,
  naaccr_factor(c("1", "8", "9"), "tumorGrowthPattern")
  naaccr_factor(c("1", "8", "9"), "tumorGrowthPattern", keep_unknown = TRUE)

naaccr documentation built on Jan. 11, 2020, 9:17 a.m.