ggobi / tourr

A implementation of tour algorithms in R
http://ggobi.github.io/tourr/
Other
65 stars 21 forks source link

save_history() doesn't change based on supplied start basis. #21

Closed nspyrison closed 3 years ago

nspyrison commented 4 years ago
remotes::install_github("ggobi/tourr") # Latest dev ver
#> Skipping install of 'tourr' from a github remote, the SHA1 (b7995b16) has not changed since last install.
#>   Use `force = TRUE` to force installation
library("tourr")
install.packages("reprex")
#> Installing package into 'C:/Users/Nicholas Spyrison/Documents/R/win-library/3.6'
#> (as 'lib' is unspecified)
#> package 'reprex' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>  C:\Users\Nicholas Spyrison\AppData\Local\Temp\RtmpUN6dDF\downloaded_packages
library("reprex")
#> Warning: package 'reprex' was built under R version 3.6.2
###

dat    <- tourr::rescale(tourr::flea[, 1:6])
bas    <- prcomp(dat)$rotation[, 1:2]

cat("Issue: save_history()'s first basis no where close to supplied start basis: \n")
#> Issue: save_history()'s first basis no where close to supplied start basis:
tpath  <- save_history(data = dat, tour_path = grand_tour(), max_bases = 2, start = bas)
b1 <- matrix(tpath[,, 1], ncol = 2, byrow = F)
b1 - bas
#>               PC1        PC2
#> tars1  0.02123195 -0.4537362
#> tars2 -0.02394871 -0.1004713
#> head  -1.05658118 -0.1691590
#> aede1 -0.52947156 -1.0148490
#> aede2  0.10620174 -0.7070230
#> aede3 -0.58455757  0.5143540

cat("Related, but working: however, animate() does start at ssupplied start basis: \n")
#> Related, but working: however, animate() does start at ssupplied start basis:
animate(dat, tour_path = grand_tour(), start = bas, max_frames = 0)
#> Using half_range 0.98

Created on 2020-03-04 by the reprex package (v0.3.0)