interactive_clustering: A shiny app for interactive clustering

View source: R/SHINY-interactive-clustering.R

interactive_clusteringR Documentation

A shiny app for interactive clustering


Display a shiny user interface to do clustering based on the provided series.


interactive_clustering(series, ...)



Time series in the formats accepted by tsclust().


More arguments for shiny::runApp().


This part of the app is simply to see some basic characteristics of the provided series and plot some of them. The field for integer IDs expects a valid R expression that specifies which of the series should be plotted. Multivariate series are plotted with each variable in a different facet.


This part of the app wraps tsclust(), so you should be familiar with it. Some remarks:

  • Specifying a custom centroid or hierarchical method expects the name of a function available in the R session (without quotes). Naturally, any required package should be loaded before calling interactive_clustering. For example, if you want to use cluster::agnes(), you should load cluster beforehand.

  • A random seed of 0 means that it will be left as NULL when calling tsclust().

  • The input fields for Extra parameters (distance, centroid and ellipsis) expect a comma- separated sequence of key-value pairs. For example: window.size = 10L, trace = TRUE. You should be able to pass any variables available in the R session's global environment.

  • Regarding plot parameters:

    • The Clusters field is like the integer IDs from the Explore section.

    • The Labels field is passed to the plot method (see TSClusters-methods). You can specify several values like with the Extra parameters, e.g.: nudge_x = 10, nudge_y = 1. You can type an empty space to activate them with the defaults, and delete everything to hide them. Note that the location of the labels is random each time.

The plot area reacts to the plot parameters, but the actual clustering with tsclust() won't be executed until you click the Cluster! button. The plot can take a couple of seconds to load! Plotting multivariate series might generate warnings about missing values, they can be safely ignored.

Some of the control parameters are disabled when dtwclust detects them automatically.

The cross-distance matrix is cached so that it can be re-used when appropriate. The cached version is invalidated automatically when necessary.


This part of the app provides results of the current clustering. External CVIs can be calculated if the name of a variable with the ground truth is provided (see cvi()).


Tracing is printed to the console.


Alexis Sarda-Espinosa


## Not run: 

## End(Not run)

dtwclust documentation built on Sept. 24, 2022, 5:05 p.m.