explain_ccsr: Look up CCSR category descriptions

View source: R/explain.R

explain_ccsrR Documentation

Look up CCSR category descriptions

Description

Look up CCSR category descriptions

Usage

explain_ccsr(ccsr, detailed = FALSE)

Arguments

ccsr

Vector of CCSR codes to be explained. Can be a mix of diagnosis and/or procedure CCSR groups.

detailed

Single logical value which indicates if more details should be returned. The default is FALSE, in which case only the description of the CCSR category is returned. If set to TRUE, it will return a list of named character vectors

Examples

# Explain the CCSR for diagnosis categories
explain_ccsr("SKN003")

# The same function works for procedures
explain_ccsr("LYM007")

# Vectorized using `mutate()`
library(dplyr)
dplyr::tibble(
  CCSR = c("NVS011", "DIG021", "MBD028", "URN001", "RES010", "CAR004"),
  Type = c("DX", "DX", "DX", "PR", "PR", "PR")) %>%
mutate(explained = explain_ccsr(CCSR))

## Examples using the detailed option
detailed <- tibble(CCSR_PR = c("URN001", "RES010", "CAR004")) %>%
  mutate(Explained = explain_ccsr(CCSR_PR),
         details   = explain_ccsr(CCSR_PR, detailed = TRUE))

library(purrr) # use purrr to extract one option
detailed %>%
  mutate(domain = map_chr(details, "clinical_domain"))

library(tidyr) ## use unnest_wider to see all details
detailed %>%
  unnest_wider(details)

HunterRatliff1/hcup documentation built on Aug. 6, 2023, 6:10 p.m.