#' Combines sdia columns for use with other functions in QRfunctions
#'
#' This function combines all sdia columns starting with sdia1, sdia2, sdia3 etc. Output will be one single column named sdia.
#' Neccesary to work with the other functions in the QRfunctions package.
#' @param .data A tibble with data in QTF-format.
#'
#'@examples
#'data(data_icd)
#'data_icd %>% combine_sdia() %>% identify_icd("L405", "psa")
#'
#' @keywords Quantify
#' @export
#' combine_sdia
combine_sdia <- function(.data) {
.data %>%
unite("sdia", matches("dia\\d"), remove = TRUE, na.rm = FALSE) %>%
mutate(sdia = str_remove_all(sdia, pattern = c("_NA|NA_|NA"))) %>%
mutate(sdia = if_else(sdia == "", NA_character_, sdia))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.