sc_left_join: Performs various checks after a left-join was performed

Description Usage Arguments Value Examples

View source: R/convenience.R

Description

One check is that no rows were duplicated during merge and the other check is that no columns were duplicated during merge.

Usage

1
sc_left_join(joined, left, right, by, ..., find_nonunique_key = TRUE)

Arguments

joined

the result of the left-join

left

the left table used in the left-join

right

the right table used in the left-join

by

the variables used for the left-join

...

further parameters that are passed to add_sanity_check.

find_nonunique_key

if TRUE a sanity-check is performed that finds keys (defined by by) that are non-unique. However this can be a time-consuming step.

Value

list with two elements for the two sanity checks performed by this function. The structure of each element is as the return object of add_sanity_check.

Examples

1
2
3
4
5
6
7
8
9
ab <- data.table::data.table(a = 1:4, b = letters[1:4])
abc <- data.table::data.table(a = c(1:4, 2), b = letters[1:5], c = rnorm(5))
j <- merge(x = ab, y = abc, by = "a")
dummy_call <- function() {
  sc_left_join(joined = j, left = ab, right = abc, by = "a",
    description = "Left join outcome to main population")
}
dummy_call()
get_sanity_checks()

sanityTracker documentation built on April 22, 2020, 5:09 p.m.