-
Notifications
You must be signed in to change notification settings - Fork 185
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorfunc trans 🌍Translation of individual functions to SQLTranslation of individual functions to SQL
Milestone
Description
@sverchkov commented on Jul 20, 2018, 7:10 PM UTC:
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.
This issue was moved by krlmlr from tidyverse/dplyr#3722.
karldw
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorfunc trans 🌍Translation of individual functions to SQLTranslation of individual functions to SQL