naaccr_factor {naaccr} | R Documentation |
Replace NAACCR codes with understandable factors
Description
Replace NAACCR codes with understandable factors
Usage
naaccr_factor(x, field, keep_unknown = FALSE, ...)
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 |
... |
Additional arguments passed onto |
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
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)
[Package naaccr version 2.0.2 Index]