sc_left_join {sanityTracker}R Documentation

Performs various checks after a left-join was performed

Description

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

Usage

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

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()

[Package sanityTracker version 0.1.0 Index]