-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: poorman | ||
Type: Package | ||
Title: A Poor Man's Base R Copy of 'dplyr' Verbs | ||
Version: 0.2.0.19 | ||
Version: 0.2.0.20 | ||
Authors@R: person("Nathan", "Eastwood", "", "[email protected]", | ||
role = c("aut", "cre")) | ||
Maintainer: Nathan Eastwood <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Compare two numeric vectors | ||
#' | ||
#' This is a safe way of comparing if two vectors of floating point numbers are (pairwise) equal. This is safer than | ||
#' using `==`, because it has a built in tolerance. | ||
#' | ||
#' @param x,y Numeric vectors to compare | ||
#' @param tol Tolerance of comparison. | ||
#' | ||
#' @examples | ||
#' sqrt(2) ^ 2 == 2 | ||
#' near(sqrt(2) ^ 2, 2) | ||
#' | ||
#' @export | ||
near <- function(x, y, tol = .Machine$double.eps^0.5) { | ||
abs(x - y) < tol | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
expect_true( | ||
near(sqrt(2)^2, 2), | ||
info = "near() accepts nearby fp values" | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.