naaccr_encode {naaccr}R 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))

[Package naaccr version 2.0.2 Index]