R/line_labels.R

Defines functions line_labels.pairwise line_labels.default line_labels

Documented in line_labels line_labels.default line_labels.pairwise

#' Create Labels for Plot
#' 
#' @template args-he
#' @param ... Additional arguments
#' @export
#' @keywords internal
#' 
line_labels <- function(he, ...) UseMethod("line_labels", he)


#' Swapped labels so that reference is second
#' @rdname line_labels
#' @export
#' 
line_labels.default <- function(he, ref_first = TRUE, ...) {
  
  if (he$n_comparisons == 1) return("")
  
  if (ref_first) {
    paste(he$interventions[he$ref], "vs",
          he$interventions[he$comp])
  } else {
    paste(he$interventions[he$comp], "vs",
          he$interventions[he$ref])
  }
}

#' @rdname line_labels
#' @export
#' 
line_labels.pairwise <- function(he, ...) {
  he$interventions[c(he$comp, he$ref)]
}

Try the BCEA package in your browser

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

BCEA documentation built on June 22, 2024, 11:08 a.m.