Learn R Programming

detourr

Animations for {tourr} using htmlwidgets for performance and portability.

Installation

Install this package by running the following in R:

remotes::install_github("casperhart/detourr")

Examples

# 2D scatter
library(tourr)
library(detourr)
detour(olive, tour_aes(projection = palmitic:eicosenoic, colour = region)) |>
  show_scatter()
# 3D scatter
detour(olive, tour_aes(projection = palmitic:eicosenoic, colour = region)) |>
  tour_path(grand_tour(3)) |>
  show_scatter()

Development

Getting Started

This project uses TypeScript code which needs to be compiled and bundled for the package to work. To do this, you will need node.js, and yarn installed.

After cloning this repository, you can install the node.js dependencies via:

yarn install

Compile and bundle the TypeScript code and install the R package from source by running:

yarn run build

The TypeScript code which powers the HTMLWidgets can also be run as a standalone app using webpack-dev-server as follows:

yarn run start-dev

This will start the webpack dev server, which will automatically recompile and reload the TypeScript code as changes are made. The sample data and HTML used by the dev server can be found in ./dev, and are loaded in to memory based on the configuration in webpack/dev.config.ts

If you wish to make changes to the HTML files in dev/, or debug the yarn run start-dev command, you can instead run yarn run build-dev. This will load the files in dev/ in to a folder called dev_build/ rather than in to memory, which can make debugging easier.

Copy Link

Version

Install

install.packages('detourr')

Monthly Downloads

252

Version

0.2.0

License

MIT + file LICENSE

Maintainer

Casper Hart

Last Published

August 28th, 2025

Functions in detourr (0.2.0)

detour-shiny

Shiny bindings for detourr
is_detour

Test for detour-ness
tour_aes

Aesthetic mapping for tours
show_sage

2D and 3D Sage Tour Display
detour

Initiate a detour visualisation
show_slice

2D and 3D Slice Display for Tours
show_scatter

2D and 3D Scatter Plot Display for Tours
reexports

Objects exported from other packages
show_scatter_internal

Internal method for 2D and 3D Scatter Plot Display
tour_path

Generate a tour path for a detour object
mnist_embeddings

Embeddings of images in the MNIST test set