req_tree_pkgs: Required packages for running 'model_tree()'

View source: R/model-tree.R

req_tree_pkgsR Documentation

Required packages for running model_tree()

Description

Required packages for running model_tree()

Usage

req_tree_pkgs(static = FALSE)

check_for_model_tree_pkgs(static = FALSE)

skip_if_tree_missing_deps(static = FALSE)

stop_if_tree_missing_deps(static = FALSE)

Arguments

static

Logical (TRUE/FALSE). If TRUE, check for additional required packages for rendering the plot as a PNG.

Details

The packages below are required for both interactive and static viewing:

  • collapsibleTree for the core plot

  • scales for coloring the tree nodes. Should be installed with ggplot2, which has been a bbr suggested package.

The packages below are all used for rendering the model tree as a static image:

  • htmlwidgets is a dependency of collapsibleTree, so it's a 'free' import. It's used to save the tree diagram out as an HTML file.

  • grid is a built-in R package and is used to display the PNG in the Rstudio viewer.

  • webshot is needed for taking a screenshot of the rendered HTML, saved out via htmlwidgets::saveWidget().

  • png is needed for reading in a PNG file as an array, in order to plot it in the Rstudio viewer.

Value

Returns a vector with the missing packages, or returns NULL if all are present.

Functions

  • check_for_model_tree_pkgs(): Checks if all packages needed for model_tree() are present

  • skip_if_tree_missing_deps(): Skip tests if missing model_tree() dependencies

  • stop_if_tree_missing_deps(): Error if missing model_tree() dependencies. Called internally within model_tree()


metrumresearchgroup/bbr documentation built on March 29, 2025, 1:08 p.m.