Save a tour path so it can later be displayed in many different ways.
save_history(
data,
tour_path = grand_tour(),
max_bases = 100,
start = NULL,
rescale = FALSE,
sphere = FALSE,
step_size = Inf,
...
)
matrix, or data frame containing numeric columns
tour path generator
maximum number of new bases to generate. Some tour paths (like the guided tour) may generate less than the maximum.
starting projection, if you want to specify one
Default FALSE. If TRUE, rescale all variables to range [0,1]?
if true, sphere all variables
distance between each step - defaults to Inf
which
forces new basis generation at each step.
additional arguments passed to tour path
# You can use a saved history to replay tours with different visualisations
t1 <- save_history(flea[, 1:6], max = 3)
#> Converting input data to the required matrix format.
animate_xy(flea[, 1:6], planned_tour(t1))
#> Converting input data to the required matrix format.
#> Using half_range 66
## andrews_history(t1)
## andrews_history(interpolate(t1))
## t1 <- save_history(flea[, 1:6], grand_tour(4), max = 3)
## animate_pcp(flea[, 1:6], planned_tour(t1))
## animate_scatmat(flea[, 1:6], planned_tour(t1))
## t1 <- save_history(flea[, 1:6], grand_tour(1), max = 3)
## animate_dist(flea[, 1:6], planned_tour(t1))
testdata <- matrix(rnorm(100 * 3), ncol = 3)
testdata[1:50, 1] <- testdata[1:50, 1] + 10
testdata <- sphere_data(testdata)
t2 <- save_history(testdata, guided_tour(holes(), max.tries = 10),
max = 5
)
#> Value 0.902 6.8 % better - NEW BASIS
#> Value 0.906 0.4 % better - NEW BASIS
#> Value 0.907 0.1 % better - NEW BASIS
#> Value 0.908 0.1 % better
#> Value 0.907 0.0 % better
#> Value 0.907 0.0 % better
#> Value 0.908 0.0 % better
#> Value 0.907 0.0 % better
#> Value 0.907 0.0 % better
#> Value 0.907 0.0 % better
#> Value 0.907 0.0 % better
#> Value 0.907 0.0 % better
#> No better bases found after 10 tries. Giving up.
#> Final projection:
#> -0.677 0.736
#> -0.507 -0.483
#> 0.533 0.475
animate_xy(testdata, planned_tour(t2))
#> Using half_range 3.1
# Or you can use saved histories to visualise the path that the tour took.
plot(path_index(interpolate(t2), holes()))