R/help.R

Defines functions getFunnelFormula

Documented in getFunnelFormula

#########################################################################
# Helper functions for creating funnel plots
#
#########################################################################

#' Edit funnel plot formula
#'
#' Edit formula passed to funnel to enable call to stats::glm
#'
#' @param formula formula passed to funnel.
#'
getFunnelFormula <- function(formula) {
  # formula without cluster term
  formula <- Formula::Formula(formula)
  newForm <- stats::formula(formula,lhs=1,rhs=1)
  vars <- all.vars(formula)
  p <- length(vars)
  # return
  list(newForm = newForm,
     outcome = vars[1],
     id = vars[p])
}
oizin/funnelplot documentation built on March 11, 2021, 2:58 p.m.