Skip to content

Commit

Permalink
Remove noOverlap (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
Puzzled-Face authored Oct 10, 2023
1 parent b6cdd56 commit 87b2f34
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 31 deletions.
36 changes: 26 additions & 10 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,35 @@ matchTolerance <- function(x, table) {
!is.na(matchTolerance(x = x, table = table))
}

##' Check overlap of two character vectors
##' checks for whole numbers (integers)
##'
##' @param a first character vector
##' @param b second character vector
##' @return returns TRUE if there is no overlap between the two character
##' vectors, otherwise FALSE
##' @param x the numeric vector
##' @param tol the tolerance
##' @return TRUE or FALSE for each element of x
##'
##' @keywords internal
noOverlap <- function(a, b) {
identical(
intersect(a, b),
character(0)
)
is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) {
abs(x - round(x)) < tol
}


##' Safe conversion to integer vector
##'
##' @param x the numeric vector
##' @return the integer vector
##'
##' @keywords internal
safeInteger <- function(x) {
testres <- is.wholenumber(x)
if (!all(testres)) {
notInt <- which(!testres)
stop(paste(
"elements",
paste(notInt, sep = ", "),
"of vector are not integers!"
))
}
as.integer(x)
}

##' Predicate checking for a probability
Expand Down
21 changes: 0 additions & 21 deletions man/noOverlap.Rd

This file was deleted.

0 comments on commit 87b2f34

Please sign in to comment.