R/format_tag_content.R

Defines functions format_tag_content

#' format_tag_content
#'
#' @inheritParams read_tags
#' @param content [data.frame] A `data.frame` created from RCC files.
#'
#' @keywords internal
#' @usage NULL
#' @noRd
#'
#' @return [data.frame]
format_tag_content <- function(tag, content) {
  if (nrow(content) == 1 && is.na(content[1, 1])) {
    output <- content
  } else {
    output <- as.data.frame(x = t(content[, -1, drop = FALSE]))
    rownames(output) <- NULL
    colnames(output) <- paste(
      tolower(sub("_.*", "", tag)),
      content[, 1],
      sep = "_"
    )
  }
  output
}

Try the NACHO package in your browser

Any scripts or data that you put into this service are public.

NACHO documentation built on Oct. 1, 2026, 5:06 p.m.