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

Can't rename selected columns with sqlite #317

Closed
wch opened this issue Mar 12, 2014 · 1 comment
Closed

Can't rename selected columns with sqlite #317

wch opened this issue Mar 12, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@wch
Copy link
Member

@wch wch commented Mar 12, 2014

Example:

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, we can rename B.y to B2
df1 <- tbl_df(dat1)
df2 <- tbl_df(dat2)
inner_join(df1, df2, by = "id") %.% select(id, A, B2 = B.y)
# Source: local data frame [3 x 3]
# 
#   id A B2
#1  1 x 10
#2  2 y 20
#3  3 x 30

# With sqlite, B.y doesn't get renamed to B2
db <- src_sqlite("test.db")
t1 <- copy_to(db, dat1)
t2 <- copy_to(db, dat2)
inner_join(t1, t2, by = "id") %.% select(id, A, B2 = B.y)
# Source: sqlite 3.7.17 [test.db]
# From: <derived table> [?? x 3]
# 
#    id A B.y
#1   1 x  10
#2   2 y  20
#3   3 x  30
# .. .. . ...```
@hadley hadley added the bug label Mar 17, 2014
@hadley hadley added this to the v0.2 milestone Mar 17, 2014
@hadley hadley self-assigned this Mar 17, 2014
@hadley
Copy link
Member

@hadley hadley commented Mar 19, 2014

Simpler test case:

db <- src_sqlite("test.db")
t1 <- copy_to(db, head(mtcars), "test")
select(t1, X = cyl)

@hadley hadley closed this in f4974d8 Mar 19, 2014
@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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants