naaccr_encode: Format a value as a string according to the NAACCR format

View source: R/write_naaccr.R

naaccr_encodeR Documentation

Format a value as a string according to the NAACCR format

Description

Format a value as a string according to the NAACCR format

Usage

naaccr_encode(x, field, flag = NULL, version = NULL, format = NULL)

Arguments

x

Vector of values.

field

Character string naming the field.

flag

Character vector of flags for the field. Only needed if the field contains sentinel values.

version

An integer specifying the NAACCR format version for parsing the records. Use this or format, not both. If both version and format are NULL (the default), the most recent version is used.

format

A record_format object for writing the records.

Value

Character vector of the values as they would be encoded in a NAACCR-formatted text file.

See Also

split_sentineled

Examples

  r <- naaccr_record(
    ageAtDiagnosis = c("089", "000", "200"),
    dateOfDiagnosis = c("20070402", "201709  ", "        ")
  )
  r
  mapply(FUN = naaccr_encode, x = r, field = names(r))

naaccr documentation built on Nov. 23, 2022, 5:06 p.m.