dualDrilldownServer: Server module server for data drilldown interaction

View source: R/dualDrilldown.R

dualDrilldownServerR Documentation

Server module server for data drilldown interaction

Description

Drilldown component with two different modes of disply and linked up to two different inputs

Usage

dualDrilldownServer(
  id,
  cdata = reactive(NULL),
  colorby,
  factorx = function(x) is.factor(cdata()[[x]]),
  ignorev = "ID",
  src1 = reactive(NULL),
  src2 = reactive(NULL)
)

Arguments

id

Character ID for specifying namespace, see shiny::NS.

cdata

A data.table of the data. This is a reactive to allow the component to be updated with new data.

colorby

A named list where name matches the (factor) variable in cdata to use for color grouping. If there is a named vector, this is passed into scale_color_manual to be used for custom color mapping, e.g. 'list(MyGroupingVar = c(A = "red", B = "blue"))' (useful for enforcing a consistent/meaningful color scheme), or use ‘list(MyGroupingVar = NULL)' if custom color scaling isn’t necessary. See also details.

factorx

Optional, a function that returns a boolean for whether a variable should be plotted as factor when given the variable name. Useful when for some reason factor variables are numeric or character instead of already factor-encoded. By default, variables are merely checked using base::is.factor, which works when the data is already factor-encoded.

ignorev

A character vector of variables such as IDs to exclude from selection for plotting. Defaults to "ID".

src1

Reactive data from "source 1".

src2

Reactive data from "source 2".

Details

The drilldown component is, at its simplest, a selectInput through which variables can be selected for adaptive visualization as a boxplot or scatterplot output (depending on whether one or two variables are selected, respectively). However, optional complexity can be added to the component by making it listen to two other sources – two independent higher-level components that can update this component's selectInput, analogous to the poor drilldown having two bosses telling it what data they want reported. Thus the "dual" describes both how the drilldown renders in two different ways as well as being able to be controlled by up to two different sources. A default factor grouping variable is required and passed into the aesthetics. If there were no default factor grouping variable, it would be unclear how to generate the boxplot view when only one variable is selected. It should also be possible to specify multiple variables to be used for grouping (which the user can switch between), but this isn't implemented yet.


avucoh/DIVE documentation built on Aug. 29, 2023, 6:02 p.m.