Learn R Programming

joinspy (version 0.7.3)

left_join_spy: Left Join with Diagnostics

Description

Performs a left join and automatically prints diagnostic information about the operation. The diagnostic report is also attached as an attribute.

Usage

left_join_spy(x, y, by, verbose = TRUE, .quiet = FALSE, ...)

Value

The joined data frame with a "join_report" attribute containing the diagnostic information.

Arguments

x

A data frame (left table).

y

A data frame (right table).

by

A character vector of column names to join by.

verbose

Logical. If TRUE (default), prints diagnostic summary.

.quiet

Logical. If TRUE, suppresses all output (overrides verbose). Useful for silent pipeline operations. Use last_report() to access the diagnostics afterward.

...

Additional arguments passed to the underlying join function.

See Also

join_spy(), join_strict(), last_report()

Examples

Run this code
orders <- data.frame(id = 1:3, value = c(10, 20, 30))
customers <- data.frame(id = c(1, 2, 4), name = c("A", "B", "D"))

result <- left_join_spy(orders, customers, by = "id")

# Access the diagnostic report
attr(result, "join_report")

# Silent mode for pipelines
result2 <- left_join_spy(orders, customers, by = "id", .quiet = TRUE)
last_report()  # Access diagnostics afterward

Run the code above in your browser using DataLab