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

Joins with data frames differ from sqlite database #310

Closed
wch opened this issue Mar 10, 2014 · 0 comments
Closed

Joins with data frames differ from sqlite database #310

wch opened this issue Mar 10, 2014 · 0 comments

Comments

@wch
Copy link
Member

@wch wch commented Mar 10, 2014

dat1 <- read.table(header=TRUE, text='
 id  A    B
  1  x  foo
  2  y  foo
  3  x  bar
')

dat2 <- read.table(header=TRUE, text='
 id  B
  1 10
  2 20
  3 30
')

# With data frames
df1 <- tbl_df(dat1)
df2 <- tbl_df(dat2)
inner_join(df1, df2, by = "id")
# Source: local data frame [3 x 4]
# 
#   id A B.x B.y
#1  1 x foo  10
#2  2 y foo  20
#3  3 x bar  30

# With sqlite
db <- src_sqlite("test.db")
t1 <- copy_to(db, dat1)
t2 <- copy_to(db, dat2)
inner_join(t1, t2, by = "id")
# Source: sqlite 3.7.17 [test.db]
# From: <derived table> [?? x 3]
# 
#    id A B
#1   1 x B
#2   2 y B
#3   3 x B
# .. .. . .

Also, when a join returns zero rows, there's a printing error:

inner_join(t1, t2)
# Joining by: c("id", "B")
# Source: sqlite 3.7.17 [test.db]
# From: <derived table> [?? x 3]
# 
# Error in format(rownames(mat))[[1]] : subscript out of bounds
hadley added a commit that referenced this issue Mar 10, 2014
@hadley hadley closed this in afe2662 Mar 10, 2014
krlmlr pushed a commit to krlmlr/dplyr that referenced this issue Mar 2, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant