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

Using .data pronoun in filter, mutate, and transmute does not work with DBI #3722

Closed
sverchkov opened this issue Jul 20, 2018 · 2 comments
Closed

Comments

@sverchkov
Copy link

sverchkov commented Jul 20, 2018

Using the .data pronoun in filter, mutate, and transmute does not work with database tables

library(dplyr)

con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)
mtcars2 <- tbl(con, "mtcars")

### Using mutate

# works
mutate(mtcars, foo = .data$cyl)

# also works
mutate(mtcars2, foo = cyl)

# doesn't
mutate(mtcars2, foo = .data$cyl)
# Error: Column `cyl` not found in `.data`

### Using transmute

# works
transmute(mtcars, blah = .data$cyl)

# also works
transmute(mtcars, blah = cyl)

# doesn't
transmute(mtcars2, blah = .data$cyl)
# Error: Column `cyl` not found in `.data`

### Using transmute to select

# works
transmute(mtcars, .data$cyl)

# also works
transmute(mtcars2, cyl)

# doesn't
transmute(mtcars2, .data$cyl)
# Error: Column `cyl` not found in `.data`

# select doesn't have this issue, this works
select( mtcars2, .data$cyl )

### Using filter

# works
filter( mtcars, .data$cyl > 4 )

# also works
filter( mtcars2, cyl > 4 )

# doesn't
filter( mtcars2, .data$cyl > 4 )
# Error: Column `cyl` not found in `.data`

(I actually ran into this when running code with a Postgres database, so it isn't DB-specific)

This is different from issue#3370, since everything works without the .data pronoun, but might be somehow related.

@sverchkov sverchkov changed the title Using .data pronoun in mutate and transmute does not work with DBI Using .data pronoun in filter, mutate and transmute does not work with DBI Jul 20, 2018
@sverchkov sverchkov changed the title Using .data pronoun in filter, mutate and transmute does not work with DBI Using .data pronoun in filter, mutate, and transmute does not work with DBI Jul 20, 2018
@tidyverse tidyverse deleted a comment from krlmlr Jul 21, 2018
@ghost
Copy link

ghost commented Jul 21, 2018

This issue was moved by krlmlr to tidyverse/dbplyr#132.

@ghost ghost closed this as completed Jul 21, 2018
@lock
Copy link

lock bot commented Jan 17, 2019

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 Jan 17, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant