From 4fa82c08591174ef3d7bd18812eee3a1593048e0 Mon Sep 17 00:00:00 2001 From: Lars Relund Date: Thu, 26 Jan 2023 13:01:34 +0100 Subject: [PATCH] Fix bugs --- R/hull.R | 11 ++++++----- R/ndset.R | 4 ++-- check.R | 10 +++------- cran-comments.md | 1 - man/convexHull.Rd | 1 + 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/R/hull.R b/R/hull.R index 49908ee..1ed5e77 100644 --- a/R/hull.R +++ b/R/hull.R @@ -378,8 +378,6 @@ addRays <- function(pts, m = apply(pts,2,min)-5, M = apply(pts,2,max)+5, directi #' facet in the hull and \code{pts} equal the input points (and dummy points) and columns: #' \code{pt}, true if a point in the original input; false if a dummy point (a point on a ray). #' \code{vtx}, TRUE if a vertex in the hull. -#' @importFrom rlang .data -#' @export #' #' @examples #' ## 1D @@ -428,6 +426,9 @@ addRays <- function(pts, m = apply(pts,2,min)-5, M = apply(pts,2,max)+5, directi #' plotHull3D(pts, addRays = TRUE) #' convexHull(pts, addRays = TRUE) #' finalize3D() +#' +#' @importFrom rlang .data +#' @export convexHull <- function(pts, addRays = FALSE, useRGLBBox = FALSE, direction = 1, tol = mean(mean(abs(pts)))*sqrt(.Machine$double.eps)*2, m = apply(pts,2,min)-5, M = apply(pts,2,max)+5) { @@ -519,10 +520,10 @@ convexHull <- function(pts, addRays = FALSE, useRGLBBox = FALSE, direction = 1, tmp <- dplyr::filter(set, .data$vtx | .data$pt, .preserve = TRUE) if (nrow(set) != nrow(tmp)) { tmp$newId <- 1:nrow(tmp) - mch <- dplyr::left_join(set, tmp, by = 'oldId') %>% dplyr::select(.data$newId) + mch <- dplyr::left_join(set, tmp, by = 'oldId') %>% dplyr::select("newId") hull <- apply(hull, c(1,2), function(id) {if (is.na(id)) return(NA) else return(mch[id,1])} ) - set <- dplyr::select(tmp, -.data$oldId, -.data$newId) - } else set <- dplyr::select(tmp, -.data$oldId) + set <- dplyr::select(tmp, -"oldId", -"newId") + } else set <- dplyr::select(tmp, -"oldId") return(list(hull = hull, pts = set)) stop("Cannot find the vertices!") } diff --git a/R/ndset.R b/R/ndset.R index 4531401..d89606e 100644 --- a/R/ndset.R +++ b/R/ndset.R @@ -1055,8 +1055,8 @@ classifyNDSet <- function(pts, direction = 1) { set1 <- set %>% left_join(x = set, y = pts[idx,], by = paste0("z", 1:p)) # match id of duplicates set1 <- set1 %>% dplyr::filter(!is.na(.data$id.y)) %>% - dplyr::mutate(id.x = .data$id.y) %>% dplyr::select(.data$z1:.data$id.x) - set <- bind_rows(set, pts[idx,]) %>% arrange(id) %>% select(-id) + dplyr::mutate(id.x = .data$id.y) %>% dplyr::select("z1":"id.x") + set <- dplyr::bind_rows(set, pts[idx,]) %>% dplyr::arrange(id) %>% dplyr::select(-id) if (nrow(set1) > 0) for (i in 1:nrow(set1)) set[set1$id.x[i],] <- set1[i, 1:(p+4)] return(set) } \ No newline at end of file diff --git a/check.R b/check.R index b20c97d..e598731 100644 --- a/check.R +++ b/check.R @@ -1,15 +1,11 @@ ## Check package -update.packages() +update.packages(ask = FALSE) devtools::spell_check() spelling::update_wordlist() devtools::check(env_vars = c(NOT_CRAN = "true", RGL_USE_NULL = "true")) -devtools::check_rhub(platforms = c("windows-x86_64-release"), interactive = F) -devtools::check_win_release(quiet = TRUE) # win-builder -# Push files to GitHub for GitHub actions check - devtools::check_rhub(interactive = F) +# devtools::check_rhub(platforms = c("windows-x86_64-release"), interactive = F) +devtools::check_win_release(quiet = TRUE) # win-builder # Push files to GitHub for GitHub actions check -devtools::release() - # Submit to CRAN devtools::release() diff --git a/cran-comments.md b/cran-comments.md index 1c2f1d8..24aa654 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -23,7 +23,6 @@ devtools::spell_check() spelling::update_wordlist() devtools::check(env_vars = c(NOT_CRAN = "true", RGL_USE_NULL = "true")) devtools::check_rhub(interactive = F) -# devtools::check_rhub(platforms = c("windows-x86_64-release"), interactive = F) devtools::check_win_release(quiet = TRUE) # win-builder # Push files to GitHub for GitHub actions check # Submit to CRAN diff --git a/man/convexHull.Rd b/man/convexHull.Rd index ff10b12..b547f86 100644 --- a/man/convexHull.Rd +++ b/man/convexHull.Rd @@ -87,4 +87,5 @@ convexHull(pts) plotHull3D(pts, addRays = TRUE) convexHull(pts, addRays = TRUE) finalize3D() + }