global_view {cheem}R Documentation

Linked plotly display, global view of data and attribution space.

Description

from a cheem_ls() list, create a linked plotly of the global data- and attribution- spaces. Typically consumed directly by shiny app.

Usage

global_view(
  cheem_ls,
  primary_obs = NULL,
  comparison_obs = NULL,
  color = c("default", "residual", "log_maha.data", "cor_attr_proj.y"),
  height_px = 480,
  width_px = 1440,
  as_ggplot = FALSE
)

Arguments

cheem_ls

A return from cheem_ls(), a list of data frames.

primary_obs

The rownumber of the primary observation. Its local attribution becomes the 1d projection basis, and the point it highlighted as a dashed line. Defaults to NULL, no highlighting applied.

comparison_obs

The rownumber of the comparison observation. Point is highlighted as a dotted line. Defaults to NULL, no highlighting applied.

color

The name of the column in cheem_ls$global_view_df to map to color. Expects c("default", "residual", "log_maha.data", "cor_attr_proj.y"). Defaults to "default"; predicted_class for classification, dummy class for regression.

height_px

The height in pixels of the returned plotly plot. Defaults to 480, does nothing when as_ggplot is TRUE.

width_px

The width in pixels of the returned plotly plot. Defaults to 1440, does nothing when as_ggplot is TRUE.

as_ggplot

Logical, if TRUE returns the plots before being passed to plotly functions.

Value

A plotly plot, an interactive html widget of the global view, first two components of the basis of the data- and attribution- spaces.

See Also

run_app()

Other cheem consumers: global_view_legwork(), radial_cheem_tour(), run_app()

Examples

library(cheem)

## Regression setup:
dat  <- amesHousing2018_NorthAmes
X    <- dat[, 1:9]
Y    <- dat$SalePrice
clas <- dat$SubclassMS

## global_view()
ames_rf_chm <- cheem_ls(X, Y, ames_rf_shap, ames_rf_pred, clas,
                        label = "North Ames, RF, SHAP")
if(interactive()){
  global_view(ames_rf_chm, as_ggplot = TRUE) ## early return of ggplot
  global_view(ames_rf_chm) ## uses ggplot facets %>% plotly

  ## Different color mappings, especially for regression
  global_view(ames_rf_chm, color = "residual")
  global_view(ames_rf_chm, color = "log_maha.data")
  global_view(ames_rf_chm, color = "cor_attr_proj.y")
}
## Also consumed by: ?run_app()

[Package cheem version 0.4.0.0 Index]