Last active
February 27, 2026 15:19
-
-
Save mikelove/92fc23d64ca0cf533ad8cdc096dd4811 to your computer and use it in GitHub Desktop.
Compact left_join.DataFrame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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, ...) | |
| } |
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
would something like this work if you just wanted to do a left join without introducing a dependency, you could wrap up the bit where you set up the join to be a helper function but I don't think you need to register a generic for it since you can let S4Vectors::merge handle dispatch?