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

The join operations causes R to crash, when tibble column names are messed up #3417

Closed
JLYJabc opened this issue Mar 13, 2018 · 8 comments
Closed
Assignees
Labels

Comments

@JLYJabc
Copy link

@JLYJabc JLYJabc commented Mar 13, 2018

this chunk of code gives a nice error message

df_a <- data.frame(A = 1:3, B = c("a", "b", "c"))
names(df_a) <- c("AA")
df_b <- data.frame(A = 2:4, C = c("aa", "bb", "cc"))
names(df_b) <- c("AA")
df_ab <- dplyr::full_join(df_a, df_b, by = "AA")

Error: Column 2 must be named

wheras these lines causes R to crash

df_a <- tibble::tibble(A = 1:3, B = c("a", "b", "c"))
names(df_a) <- c("AA")
df_b <- tibble::tibble(A = 2:4, C = c("aa", "bb", "cc"))
names(df_b) <- c("AA")
df_ab <- dplyr::full_join(df_a, df_b, by = "AA")

(It also crashes with base::data.frame())

@batpigandme
Copy link
Member

@batpigandme batpigandme commented Mar 13, 2018

Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

@JLYJabc
Copy link
Author

@JLYJabc JLYJabc commented Mar 13, 2018

I've updated the post, let me know if it is ok now?
(first time doing this)

@batpigandme
Copy link
Member

@batpigandme batpigandme commented Mar 13, 2018

Hi @JLYJabc,

OK, so I sent you on a bit of a goose chase, because (since it causes a crash, or, for me, an endless process), it's un-reprex-able.

So, here's a lengthy reprex, printing all but that final step (which isn't in the reprex because, well, see above).

df_a <- data.frame(A = 1:3, B = c("a", "b", "c"))
df_a
#>   A B
#> 1 1 a
#> 2 2 b
#> 3 3 c
names(df_a) <- c("AA")
df_a
#>   AA NA
#> 1  1  a
#> 2  2  b
#> 3  3  c
df_b <- data.frame(A = 2:4, C = c("aa", "bb", "cc"))
df_b
#>   A  C
#> 1 2 aa
#> 2 3 bb
#> 3 4 cc
names(df_b) <- c("AA")
df_b
#>   AA NA
#> 1  2 aa
#> 2  3 bb
#> 3  4 cc
df_ab <- dplyr::full_join(df_a, df_b, by = "AA")
#> Error: Column 2 must be named

df_a <- tibble::tibble(A = 1:3, B = c("a", "b", "c"))
names(df_a) <- c("AA")
df_a
#> # A tibble: 3 x 2
#>      AA `NA` 
#>   <int> <chr>
#> 1     1 a    
#> 2     2 b    
#> 3     3 c
df_b <- tibble::tibble(A = 2:4, C = c("aa", "bb", "cc"))
names(df_b) <- c("AA")
df_b
#> # A tibble: 3 x 2
#>      AA `NA` 
#>   <int> <chr>
#> 1     2 aa   
#> 2     3 bb   
#> 3     4 cc

Created on 2018-03-13 by the reprex package (v0.2.0).

After this, the line below ⇨ wonkiness…

df_ab <- dplyr::full_join(df_a, df_b, by = "AA")

I don't have a solution yet, just reproducing for now!

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Mar 13, 2018

I can reproduce the endlessness.

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Mar 13, 2018

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Mar 13, 2018

I'm working on it as part of #3307.

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Mar 15, 2018

In 0.7.4 I'm seeing dplyr caught in an endless loop with the original example. This means we can safely raise an error here without breaking "compatibility".

@lock
Copy link

@lock lock bot commented Sep 12, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants