Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active February 27, 2026 15:19
Show Gist options
  • Select an option

  • Save mikelove/92fc23d64ca0cf533ad8cdc096dd4811 to your computer and use it in GitHub Desktop.

Select an option

Save mikelove/92fc23d64ca0cf533ad8cdc096dd4811 to your computer and use it in GitHub Desktop.
Compact left_join.DataFrame
# adapted from DFplyr
# ignoring rownames and GroupedDataFrame functionality...
left_join.DataFrame <- function(x, y, by = NULL, ...) {
if (is.null(by)) {
by <- intersect(names(x), names(y))
if (length(by) == 0) {
rlang::abort("`by` must be supplied when `x` and `y` have no common variables.")
}
message("Joining with `by = ", deparse(by), "`")
}
S4Vectors::merge(x, y, by = by, sort = FALSE, ...)
}
@mikelove
Copy link
Author

thanks! I'll work on adding/testing this next week (my end of week got backed up with deadlines)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment