R/helper_functions.R

Defines functions process_category_items

Documented in process_category_items

# ====================
# helper_functions.R
# ====================

#' Process Category Items
#'
#' Internal helper function to process WAVE category items
#'
#' @param items List. Category items from WAVE results
#' @param category_type Character string. Type of category being processed
#'
#' @return Tibble containing processed item data
#' @keywords internal
process_category_items <- function(items, category_type) {
  if (is.null(items) || length(items) == 0) {
    return(NULL)
  }

  tibble(
    issue = sapply(items, function(x) x$description),
    count = sapply(items, function(x) x$count),
    type = category_type
  )
}

Try the waetr package in your browser

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

waetr documentation built on April 16, 2025, 5:11 p.m.