Tour a high dimensional dataset

limn_tour(
  tour_data,
  cols,
  color = NULL,
  tour_path = tourr::grand_tour(),
  rescale = clamp,
  morph = "center",
  gadget_mode = TRUE
)

Arguments

tour_data

a data.frame to tour

cols

Columns to tour. This can use a tidyselect specification such as tidyselect::starts_with().

color

A variable mapping to the color aesthetic, if NULL points will be colored black.

tour_path

the tour path to take, the default is tourr::grand_tour() but also works with tourr::guided_tour().

rescale

A function that rescales cols, the default is to clamp() the data to lie in the hyperdimensional unit cube. To not perform any scaling use identity().

morph

One of c("center", "centre", "identity", "radial") that rescales each projection along the tour path. The default is to center the projections and divide by half range. See morph_center() for details.

gadget_mode

Run the app as a shiny::runGadget() which will load the app in the RStudio Viewer pane or a browser (default = TRUE). If FALSE will return a regular shiny app object that could be used to deploy the app elsewhere.

Value

The tour interface loads a shiny app either in the Viewer pane if you are using Rstudio or in a browser window. After iterating through the tour and and highlighting subsets of interest, you can click the 'Done' button. This will return a named list with two elements:

  • selected_basis: a matrix consisting of the final projection selected

  • tour_brush_box: a list consisting of the bounding box of brush

  • tour_half_range: the current value of half range parameter

Details

The tour interface consists of two views:

  1. the tour view which is a dynamic scatterplot

  2. the axis view which shows the direction and magnitude of the basis vectors being generated.

There are several other user controls available:

  • A play button, that when pressed will start the tour animation.

  • A pause button, that when pressed will pause the tour animation.

  • The title of the view includes the half range. The half range is a scale factor for projections and can be thought of as a way of zooming in and out on points. It can be modified by scrolling (via a mouse-wheel movement). Double-click to reset to the default tour view.

  • If categorical variable has been used, the legend can be toggled to highlight categories of interest with shift + mouse click. Multiple categories can be selected in this way. To reset double click the legend title.

  • Brushing is activated by moving the mouse on the tour view. If the tour animation a brush event will pause it.

See also

Examples

if (interactive()) {
  # tour the first ten columns of the fake tree data
  # loads the default interface
  limn_tour(fake_trees, dim1:dim10)
  # perform the same action but now coloring points
  limn_tour(fake_trees, dim1:dim10, color = branches)
}