Skip to content

Commit

Permalink
fixes for CRAN submission
Browse files Browse the repository at this point in the history
  • Loading branch information
dicook committed Aug 25, 2022
1 parent ac305ca commit 4021bd2
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 163 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ License: MIT + file LICENSE
LazyData: true
URL: https://github.com/ggobi/tourr
BugReports: https://github.com/ggobi/tourr/issues
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1
Encoding: UTF-8
VignetteBuilder: knitr
116 changes: 0 additions & 116 deletions NEWS

This file was deleted.

4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# tourr 0.6.1

A radial tour is added that will allow a variable to be zero'd from a projection.
* A radial tour is added that will allow a variable to be zero'd from a projection.

* Fixes made according to CRAN requests

# tourr 0.6.0

Expand Down
2 changes: 1 addition & 1 deletion R/animate.r
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ animate <- function(data, tour_path = grand_tour(), display = display_xy(),
start = NULL, aps = 1, fps = 10, max_frames = Inf,
rescale = TRUE, sphere = FALSE, ...) {
record <-
dplyr::tibble(
tibble::tibble(
basis = list(),
index_val = numeric(),
info = character(),
Expand Down
13 changes: 5 additions & 8 deletions R/data.r
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,17 @@ NULL
#' Monthly ozone measurements over Central America
#'
#'
#' This data set is a subset of the data from the 2006 ASA Data expo challenge,
#' \url{https://community.amstat.org/jointscsg-section/dataexpo/new-item5}.
#' The data are monthly ozone
#' averages on a very coarse 24 by 24 grid covering Central America, from Jan
#' 1995 to Dec 2000. The data is stored in a 3d area with the first two
#' dimensions representing latitude and longitude, and the third representing
#' This data set is a subset of the data from the 2006 ASA Data expo challenge.
#' The data are monthly ozone averages on a very coarse 24 by 24 grid covering
#' Central America, from Jan 1995 to Dec 2000. The data is stored in a 3d area
#' with the first two dimensions representing latitude and longitude, and the
#' third representing
#' time.
#'
#'
#' @name Ozone measurements
#' @aliases ozone
#' @docType data
#' @format A 24 x 24 x 72 numeric array
#' @references \url{https://community.amstat.org/jointscsg-section/dataexpo/new-item5}
#' @keywords datasets
#' @examples
#'
Expand Down
9 changes: 7 additions & 2 deletions R/display-xy.r
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ display_xy <- function(center = TRUE, axes = "center", half_range = NULL,
rect(-1, -1, 1, 1, col = "#FFFFFFE6", border = NA)
}
render_data <- function(data, proj, geodesic) {
draw_tour_axes(proj, labels, limits = 1, axes)
draw_tour_axes(proj, labels, limits = 1, axes, ...)

# Render projected points
x <- data %*% proj
Expand Down Expand Up @@ -106,7 +106,7 @@ animate_xy <- function(data, tour_path = grand_tour(), ...) {

#' Draw tour axes with base graphics
#' @keywords internal
draw_tour_axes <- function(proj, labels, limits, position) {
draw_tour_axes <- function(proj, labels, limits, position, ...) {
position <- match.arg(position, c("center", "bottomleft", "off"))
if (position == "off") {
return()
Expand All @@ -123,6 +123,11 @@ draw_tour_axes <- function(proj, labels, limits, position) {
adj <- function(x) axis_pos + x * axis_scale

segments(adj(0), adj(0), adj(proj[, 1]), adj(proj[, 2]), col = "grey50")
# if (!is.null(mvar)) { # colour manip var
# if ((mvar < (nrow(proj)+1)) & (mvar > 0)) {
# segments(adj(0), adj(0), adj(proj[, 1]), adj(proj[, 2]), col = "orange")
# }
# }
theta <- seq(0, 2 * pi, length = 50)
lines(adj(cos(theta)), adj(sin(theta)), col = "grey50")
text(adj(proj[, 1]), adj(proj[, 2]), label = labels, col = "grey50")
Expand Down
2 changes: 1 addition & 1 deletion R/geodesic-path.r
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @export
#' @keywords internal
new_geodesic_path <- function(name, generator, frozen = NULL, ...) {
tries <- 1
tries <- 1 # Needed for guided

tour_path <- function(current, data, ...) {
if (is.null(current)) {
Expand Down
2 changes: 1 addition & 1 deletion R/history.r
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ save_history <- function(data, tour_path = grand_tour(), max_bases = 100, start
if (sphere) data <- sphere_data(data)

record <-
dplyr::tibble(
tibble::tibble(
basis = list(),
index_val = numeric(),
info = character(),
Expand Down
2 changes: 1 addition & 1 deletion R/interpolate.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interpolate <- function(basis_set, angle = 0.05, cycle = FALSE) {
}

record <-
dplyr::tibble(
tibble::tibble(
basis = list(),
index_val = numeric(),
info = character(),
Expand Down
2 changes: 1 addition & 1 deletion R/render.r
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ render <- function(data, tour_path, display, dev, ..., apf = 1 / 10, frames = 50
on.exit(dev.off())

record <-
dplyr::tibble(
tibble::tibble(
basis = list(),
index_val = numeric(),
info = character(),
Expand Down
2 changes: 1 addition & 1 deletion R/search-frozen-geodesic.r
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ find_best_frozen_dir <- function(old, frozen, index, dist = 0.01, counter = 5) {

larger <- max(index(forward), index(backward))

dplyr::tibble(
tibble::tibble(
basis = c(list(forward), list(backward)),
index_val = c(index(forward), index(backward)),
info = "direction_search",
Expand Down
4 changes: 2 additions & 2 deletions R/search-geodesic.r
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ find_best_dir <- function(old, index, dist = 0.01, counter = 5, ...) {

larger <- max(index(forward), index(backward))

dplyr::tibble(
tibble::tibble(
basis = c(list(forward), list(backward)),
index_val = c(index(forward), index(backward)),
info = "direction_search",
Expand Down Expand Up @@ -158,7 +158,7 @@ find_path_peak <- function(old, new, index, max_dist = pi / 4, ...) {

alpha <- stats::optimize(index_pos, c(-max_dist, max_dist), maximum = TRUE, tol = 0.01)

best <- dplyr::tibble(
best <- tibble::tibble(
basis = list(step_angle(interpolator, alpha$maximum)),
index_val = alpha$objective,
info = "best_line_search",
Expand Down
2 changes: 1 addition & 1 deletion R/search_polish.r
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ search_polish <- function(current, alpha = 0.5, index, tries, polish_max_tries =
while (try <= polish_max_tries) {
# could use replicate here
basis <- lapply(1:n_sample, function(x) {
dplyr::tibble(basis = list(basis_nearby(current,
tibble::tibble(basis = list(basis_nearby(current,
alpha = alpha
)))
})
Expand Down
4 changes: 2 additions & 2 deletions R/tour-guided.r
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ guided_tour <- function(index_f, d = 2, alpha = 0.5, cooling = 0.99, max.tries =
},
error = function(e){
assign("record",
dplyr::tibble(basis = list(),
tibble::tibble(basis = list(),
index_val = numeric(),
info = character(),
method = character(),
alpha = numeric(),
tries = numeric(),
loop = numeric()),
envir = parent.frame())
rcd_env[["record"]] <- dplyr::tibble(
rcd_env[["record"]] <- tibble::tibble(
basis = list(current),
index_val = cur_index,
info = "new_basis",
Expand Down
15 changes: 8 additions & 7 deletions R/tour-radial.r
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@
#' \code{\link{save_history}} or \code{\link{render}}.
#'
#' @param start initial projection matrix
#' @param var variable chosen to rotate out
#' @param mvar variable chosen to rotate out
#' @param ... additional arguments for drawing
#' @export
#' @examples
#' animate_xy(flea[, 1:6], radial_tour(basis_random(6, 2), var = 4))
#' animate_dist(flea[, 1:6], radial_tour(basis_random(6, 1), var = 4))
#' animate_scatmat(flea[, 1:6], radial_tour(basis_random(6, 3), var = 4))
radial_tour <- function(start, var = 1) {
#' animate_xy(flea[, 1:6], radial_tour(basis_random(6, 2), mvar = 4))
#' animate_dist(flea[, 1:6], radial_tour(basis_random(6, 1), mvar = 4))
#' animate_scatmat(flea[, 1:6], radial_tour(basis_random(6, 3), mvar = 4))
radial_tour <- function(start, mvar = 1, ...) {
first <- TRUE
out <- TRUE

generator <- function(current, data, ...) {
generator <- function(current, data, mvar, ...) {
if (first) {
new_basis <- start
first <<- FALSE
return(new_basis)
}
if (out) {
new <- start
new[var,] <- rep(0, ncol(start))
new[mvar,] <- rep(0, ncol(start))
new <- orthonormalise(new)
new_basis <- new
out <<- !out
Expand Down
4 changes: 2 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Additional authors
## Fixes as requested by CRAN

Several additional contributors have provided new methods.
This removes the reported html errors.

## R CMD check results
There were no ERRORs, NOTESs or WARNINGs.
Expand Down
14 changes: 5 additions & 9 deletions man/Ozone-measurements.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/draw_tour_axes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions man/radial_tour.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4021bd2

Please sign in to comment.