Learn R Programming

scrutiny (version 1.0.0)

duplicate_count_colpair: Count duplicate values by column pair

Description

duplicate_count_colpair() counts, for every pair of columns in a data frame, the values that occur in both. Results are ordered by that count, in descending order.

Usage

duplicate_count_colpair(data, ignore = NULL, show_rates = TRUE)

Value

A tibble with these columns:

  • x, y: a pair of columns of data, one pair per row.

  • count: the number of values of x that also occur in y. Missing and ignored values are not counted.

  • total_x, total_y: the number of values in x and y that are neither missing nor ignored.

  • rate_x: the proportion of x values that occur in y, i.e., count / total_x, or NA if total_x is 0.

  • rate_y: the same for y. It differs from count / total_y if a value repeats within a column.

Arguments

data

Data frame or matrix with at least two columns. Blank strings, "NA", and "NaN" count as missing.

ignore

Optionally, a vector of values not to count.

show_rates

Logical. If TRUE (the default), add total_x, total_y, rate_x, and rate_y; see Value. FALSE is faster.

Summaries with <code>audit()</code>

audit() on duplicate_count_colpair() output returns summary statistics for the numeric columns.

See Also

  • duplicate_count() for a frequency table.

  • duplicate_tally() for counts next to each value.

  • janitor::get_dupes() for duplicate rows.

Examples

Run this code
mtcars |>
  duplicate_count_colpair()

mtcars |>
  duplicate_count_colpair() |>
  audit()

Run the code above in your browser using DataLab