array2df | R Documentation |
Internal function, many end users will not need this. Takes the result of
manual_tour()
or tourr::save_history()
. Restructures the array of
interpolated bases into a long data frame for use in ggplots.
array2df( basis_array, data = NULL, basis_label = NULL, data_label = rownames(data), do_center_frame = TRUE )
basis_array |
A full (p, d, n_frames) interpolated basis array of a
tour, the output of |
data |
Optional, (n, p) dataset to project, consisting of numeric variables. |
basis_label |
Labels for basis display, a character vector with length equal to the number of variables. Defaults to NULL; 3 character abbreviation from colnames of data or rownames of basis. |
data_label |
Labels for |
do_center_frame |
Whether or not to center the mean within each animation frame. Defaults to TRUE. |
## !!This function is not meant for external use!! dat <- scale_sd(wine[, 2:6]) clas <- wine$Type bas <- basis_pca(dat) mv <- manip_var_of(bas) ## Radial tour array to long df, as used in play_manual_tour() mt_array <- manual_tour(basis = bas, manip_var = mv) ls_df_frames <- array2df(basis_array = mt_array, data = dat, basis_label = paste0("MyLabs", 1:nrow(bas))) str(ls_df_frames) ## tourr::save_history tour array to long df, as used in play_tour_path() gt_array <- tourr::save_history(data = dat, max_bases = 10) ls_df_frames2 <- array2df(basis_array = gt_array, data = dat) str(ls_df_frames2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.