report_diff: Report pairwise differences between two vectors

View source: R/vector_tools.R

report_diffR Documentation

Report pairwise differences between two vectors

Description

Compares each element of two vectors to each other and reports the number of total matches and mismatches, as well as a count for each unique mismatch.

Usage

report_diff(l, r, full = TRUE)

Arguments

l

(Vector) Any vector.

r

(Vector) Any vector.

full

(Logical) If TRUE (default), adds counts of each specific mismatch to the dataframe output. If FALSE, only shows the first two rows of the output (the overall count of matches and mismatches).

Value

A dataframe.

Authors

Examples

v1 <- c(1, 2, 3, 4, 5, NA, NA)
v2 <- c(1, 2, 5, 4, 3, NA, 7)

report_diff(v1, v2)

#>         pairs count
#> 1      l == r     4
#> 2      l != r     3
#> 3  `3` != `5`     1
#> 4  `5` != `3`     1
#> 5 `NA` != `7`     1

report_diff(v1, v2, full = FALSE)

#>    pairs count
#> 1 l == r     4
#> 2 l != r     3


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.