You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Long-story-short, I had swapped one of the by= names/values, so internally, y was not finding the associated field name. While that mistake is wholly mine, it would be really useful if the error was detected a little earlier and announced a little more clearly.
Perhaps something like:
if (!all(by$x%in% names(x)) stop("columns not found in 'x': ", setdiff(by$x, names(x))) ## added 1if (!all(by$y%in% names(y)) stop("columns not found in 'y': ", setdiff(by$y, names(y))) ## added 2matches<-dplyr::bind_rows(lapply(seq_along(by$x), function(i) {
col_x<-x[[by$x[i]]]
col_y<-y[[by$y[i]]]
if (is.null(col_x) || is.null(col_y)) stop("something else") ## added 3...
In my case, additional lines "1" and "2" would have been immediately obvious what I did wrong. The "added 3" if statement is mostly a catchall so that the user is given a fuzzyjoin-error instead of an error from bind_rows. I don't know what the best error message would be there...
Thanks!
The text was updated successfully, but these errors were encountered:
Thanks for
fuzzyjoin
!I recently spent several minutes troubleshooting an odd (to me) error (and its associated stack trace):
Long-story-short, I had swapped one of the
by=
names/values, so internally,y
was not finding the associated field name. While that mistake is wholly mine, it would be really useful if the error was detected a little earlier and announced a little more clearly.Perhaps something like:
In my case, additional lines "1" and "2" would have been immediately obvious what I did wrong. The "added 3"
if
statement is mostly a catchall so that the user is given afuzzyjoin
-error instead of an error frombind_rows
. I don't know what the best error message would be there...Thanks!
The text was updated successfully, but these errors were encountered: