Skip to content

Commit

Permalink
Merge pull request satijalab#194 from satijalab/fix/PolyVtx
Browse files Browse the repository at this point in the history
Bug fix in `PolyVtx()`
  • Loading branch information
mojaveazure authored Apr 3, 2024
2 parents ee5ea0c + c2b5032 commit 7bb1759
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: SeuratObject
Type: Package
Title: Data Structures for Single Cell Data
Version: 5.0.1.9006
Version: 5.0.1.9007
Authors@R: c(
person(given = 'Paul', family = 'Hoffman', email = '[email protected]', role = 'aut', comment = c(ORCID = '0000-0002-7693-8957')),
person(given = 'Rahul', family = 'Satija', email = '[email protected]', role = c('aut', 'cre'), comment = c(ORCID = '0000-0001-9448-8833')),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Class key-based warnings (#180)
- Require R 4.1 (#180)
- Fix errors in `UpdateSeuratObject` (@ddiez, #182)
- Fix bug in `PolyVtx` (#194)

# SeuratObject 5.0.1

Expand Down
17 changes: 11 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,7 @@ PackageCheck <- function(..., error = TRUE) {
#' @references \url{https://stackoverflow.com/questions/3436453/calculate-coordinates-of-a-regular-polygons-vertices}
#'
#' @examples
#' coords <- PolyVtx(5, t1 = 90)
#' coords
#' (coords <- PolyVtx(5, t1 = 90))
#' if (requireNamespace("ggplot2", quietly = TRUE)) {
#' ggplot2::ggplot(coords, ggplot2::aes(x = x, y = y)) + ggplot2::geom_polygon()
#' }
Expand All @@ -1403,10 +1402,16 @@ PolyVtx <- function(n, r = 1L, xc = 0L, yc = 0L, t1 = 0) {
} else if (n < 3L) {
abort(message = "'n' must be greater than or equal to 3")
}
stopifnot(is_bare_integerish(x = r, n = 1L, finite = TRUE))
stopifnot(is_bare_integerish(x = xc, n = 1L, finite = TRUE))
stopifnot(is_bare_integerish(x = yc, n = 1L, finite = TRUE))
stopifnot(is_bare_numeric(x = t1, n = 1L))
stopifnot(
"'r' must be a single, finite number" = is_bare_numeric(x = r, n = 1L) &&
is.finite(x = r),
"'xc' must be a single, finite number" = is_bare_numeric(x = xc, n = 1L) &&
is.finite(x = xc),
"'yc' must be a single, finite number" = is_bare_numeric(x = yc, n = 1L) &&
is.finite(x = yc),
"'t1' must be a single, finite number" = is_bare_numeric(x = t1, n = 1L) &&
is.finite(x = t1)
)
t1 <- Radians(deg = t1)
coords <- matrix(data = 0, nrow = n, ncol = 2)
colnames(x = coords) <- c('x', 'y')
Expand Down
3 changes: 1 addition & 2 deletions man/PolyVtx.Rd

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

0 comments on commit 7bb1759

Please sign in to comment.