Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check whether two numeric vectors are close_enough() #26

Merged
merged 7 commits into from
Oct 25, 2021
Merged

Conversation

kelly-sovacool
Copy link
Member

@kelly-sovacool kelly-sovacool commented Oct 22, 2021

Really just a shortcut to all(dplyr::near(x, y, tol=10^-3) for less precision.
I like to use it in a manuscript paired with assertthat::assert_that() to make sure the numbers I report don't change drastically when I re-run code.

I also did a bit of reorganizing; moved is_nearly_whole() to R/utils.R.

Change(s) made

  • Create function close_enough() to check whether two numeric vectors are fairly close.

Checklist

(Strikethrough any points that are not applicable.)

  • Write unit tests for any new functionality.
  • Update roxygen comments & vignettes if there are any API changes.
  • Update NEWS.md if this includes any user-facing changes.
  • The check workflow succeeds on your most recent commit.

Really just a shortcut to all(dplyr::near(x, y, tol=10^-3) for less
precision.
@kelly-sovacool kelly-sovacool added the feature a feature request or enhancement label Oct 25, 2021
@kelly-sovacool kelly-sovacool requested review from a team and jmoltzau and removed request for a team October 25, 2021 21:02
@kelly-sovacool kelly-sovacool marked this pull request as ready for review October 25, 2021 21:02
@jmoltzau jmoltzau merged commit 6730c0d into main Oct 25, 2021
@jmoltzau jmoltzau deleted the close-enough branch October 25, 2021 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants