View source: R/naaccr_factor.R
unknown_to_na | R Documentation |
Replace labels for unknown with NA
unknown_to_na(x, ...) ## S3 method for class 'naaccr_record' unknown_to_na(x, ...) ## S3 method for class 'factor' unknown_to_na(x, field, ...)
x |
Either a factor created with |
... |
Further arguments passed to or from other methods. |
field |
String giving the XML name of the NAACCR field to code. |
If x
was a factor
, then the result is a vector with the
values of x
, except all levels which effectively mean "unknown" are
replaced with NA
.
The returned factor won't have those in its levels, either.
If x
is a naaccr_record
object, then the result is the
naaccr_record
created by applying this function to all columns of
x
.
r <- naaccr_record( sex = c("1", "2", "9"), kras = c("8", "9", "3"), keep_unknown = TRUE ) r unknown_to_na(r[["sex"]], field = "sex") unknown_to_na(r)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.