Learn R Programming

spinifex (version 0.2.5)

array2df: Turns a tour path array into a long data frame.

Description

Typically called by a wrapper function, play_manual_tour or play_tour_path. Takes the result of tourr::save_history() or manual_tour() and restructures the data from an array to a long data frame for use in ggplots.

Usage

array2df(array, data = NULL, lab = NULL)

Arguments

array

A (p, d, n_slides) array of a tour, the output of manual_tour().

data

Optional, (n, p) dataset to project, consisting of numeric variables.

lab

Optional, labels for the reference frame of length 1 or the number of variables used. Defaults to an abbreviation of the variables.

Value

A list containing an array of basis slides (p, d, n_slides) and an array of data slides (n, d, n_slides) if data is present.

Examples

Run this code
# NOT RUN {
flea_std <- tourr::rescale(tourr::flea[, 1:6])

rb <- tourr::basis_random(n = ncol(flea_std))
mtour <- manual_tour(basis = rb, manip_var = 4)
array2df(array = mtour, data = flea_std)
# }

Run the code above in your browser using DataLab