Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic error message in case of misused xxx_join(..., by=c(...)) #1192

Closed
petermeissner opened this issue Jun 2, 2015 · 1 comment
Closed
Assignees
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@petermeissner
Copy link

This is no bug report rather a request to give more informative error messages.

If the following misuse of the join functions is undertaken the error messages are somewhat cryptic:

     data2 <- data_frame(a=1:3)
     data1 <- data_frame(a=1:3, c=3:5)

     left_join(data1, data2, by=c("a","a"))

     ## Error in left_join_impl(x, y, by$x, by$y) : attempt to set index 0/0 in SET_STRING_ELT

While the input should have been ...

     left_join(data1, data2, by=c("a"="a"))    

    ## Source: local data frame [3 x 2]
    ## 
    ##   a c
    ## 1 1 3
    ## 2 2 4
    ## 3 3 5

... a syntax error that is easy to do and hard to find.

@almartin82
Copy link

if this is at all helpful, here's where I ran into attempt to set index 0/0 in SET_STRING_ELT: when trying to apply a function rowwise() on a zero-row df.

here was the offending call

df %>%
      rowwise() %>%
      mutate(
        cgp_label = cgp_labeler(n, cgp)  
      ) %>%
      as.data.frame

I added a defensive statement in my cgp_labeler function to make the error more informative.

@hadley hadley added the bug an unexpected problem or unintended behavior label Aug 24, 2015
@hadley hadley added this to the 0.5 milestone Aug 24, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants