Skip to content

Commit 9ece085

Browse files
committed
docs(approx_equal): iterate on @return + doc approx_equal0
1 parent 56aa92d commit 9ece085

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

R/patch.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
#' be consistent with `vec_slice`-ing to these indices beforehand, but can
1212
#' give faster computation if `vec1` and `vec2` are data frames.
1313
#'
14-
#' @return logical vector; no nonmissing entries if `na_equal = TRUE`. Behavior
15-
#' may differ from `vec_equal` with non-`NA` `NaN`s involved, or for bare
16-
#' lists that contain named vectors.
14+
#' @return logical vector, with length matching the result of recycling `vec1`
15+
#' (at `inds1` if provided) and `vec2` (at `inds2` if provided); entries
16+
#' should all be `TRUE` or `FALSE` if `na_equal = TRUE`. Behavior may differ
17+
#' from `vec_equal` with non-`NA` `NaN`s involved, or for bare lists that
18+
#' contain named vectors.
1719
approx_equal <- function(vec1, vec2, abs_tol, na_equal, .ptype = NULL, inds1 = NULL, inds2 = NULL) {
1820
# Recycle inds if provided; vecs if not:
1921
common_size <- vec_size_common(
@@ -34,6 +36,9 @@ approx_equal <- function(vec1, vec2, abs_tol, na_equal, .ptype = NULL, inds1 = N
3436
approx_equal0(vecs[[1]], vecs[[2]], abs_tol, na_equal, inds1, inds2)
3537
}
3638

39+
#' Helper for [`approx_equal`] for vecs guaranteed to have the same ptype and size
40+
#'
41+
#' @keywords internal
3742
approx_equal0 <- function(vec1, vec2, abs_tol, na_equal, inds1 = NULL, inds2 = NULL) {
3843
if (is_bare_numeric(vec1) && abs_tol != 0) {
3944
# perf: since we're working with bare numerics and logicals: we can use `[`

man/approx_equal.Rd

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/approx_equal0.Rd

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)