{"action":"opened","issue":{"url":"https://api.github.com/repos/hadley/dplyr/issues/1428","labels_url":"https://api.github.com/repos/hadley/dplyr/issues/1428/labels{/name}","comments_url":"https://api.github.com/repos/hadley/dplyr/issues/1428/comments","events_url":"https://api.github.com/repos/hadley/dplyr/issues/1428/events","html_url":"https://github.com/hadley/dplyr/issues/1428","id":108887032,"number":1428,"title":"Inconsistent multiple `filter()` in sqlite","user":{"login":"gregmacfarlane","id":2234830,"avatar_url":"https://avatars.githubusercontent.com/u/2234830?v=3","gravatar_id":"","url":"https://api.github.com/users/gregmacfarlane","html_url":"https://github.com/gregmacfarlane","followers_url":"https://api.github.com/users/gregmacfarlane/followers","following_url":"https://api.github.com/users/gregmacfarlane/following{/other_user}","gists_url":"https://api.github.com/users/gregmacfarlane/gists{/gist_id}","starred_url":"https://api.github.com/users/gregmacfarlane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregmacfarlane/subscriptions","organizations_url":"https://api.github.com/users/gregmacfarlane/orgs","repos_url":"https://api.github.com/users/gregmacfarlane/repos","events_url":"https://api.github.com/users/gregmacfarlane/events{/privacy}","received_events_url":"https://api.github.com/users/gregmacfarlane/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-29T14:52:31Z","updated_at":"2015-09-29T14:52:31Z","closed_at":null,"body":"`filter()` from a set of values of length 1 behaves differently on a sqlite table than on a local `data_frame`. This makes it hard to write functions where the filter variable might change.\r\n\r\n```r\r\nlibrary(dplyr, warn.conflicts = FALSE)\r\n\r\nmy_db <- src_sqlite(\"my_db.sqlite3\", create = T)\r\ncopy_to(my_db, mtcars, temporary = FALSE)\r\n```\r\n\r\n```\r\n## Source: sqlite 3.8.6 [my_db.sqlite3]\r\n## From: mtcars [32 x 11]\r\n## \r\n##      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb\r\n##    (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl)\r\n## 1   21.0     6 160.0   110  3.90 2.620 16.46     0     1     4     4\r\n## 2   21.0     6 160.0   110  3.90 2.875 17.02     0     1     4     4\r\n## 3   22.8     4 108.0    93  3.85 2.320 18.61     1     1     4     1\r\n## 4   21.4     6 258.0   110  3.08 3.215 19.44     1     0     3     1\r\n## 5   18.7     8 360.0   175  3.15 3.440 17.02     0     0     3     2\r\n## 6   18.1     6 225.0   105  2.76 3.460 20.22     1     0     3     1\r\n## 7   14.3     8 360.0   245  3.21 3.570 15.84     0     0     3     4\r\n## 8   24.4     4 146.7    62  3.69 3.190 20.00     1     0     4     2\r\n## 9   22.8     4 140.8    95  3.92 3.150 22.90     1     0     4     2\r\n## 10  19.2     6 167.6   123  3.92 3.440 18.30     1     0     4     4\r\n## ..   ...   ...   ...   ...   ...   ...   ...   ...   ...   ...   ...\r\n```\r\n\r\n```r\r\ntbl(my_db, \"mtcars\") %>% filter(cyl == 6)\r\n```\r\n\r\n```\r\n## Source: sqlite 3.8.6 [my_db.sqlite3]\r\n## From: mtcars [7 x 11]\r\n## Filter: cyl == 6 \r\n## \r\n##     mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb\r\n##   (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl)\r\n## 1  21.0     6 160.0   110  3.90 2.620 16.46     0     1     4     4\r\n## 2  21.0     6 160.0   110  3.90 2.875 17.02     0     1     4     4\r\n## 3  21.4     6 258.0   110  3.08 3.215 19.44     1     0     3     1\r\n## 4  18.1     6 225.0   105  2.76 3.460 20.22     1     0     3     1\r\n## 5  19.2     6 167.6   123  3.92 3.440 18.30     1     0     4     4\r\n## 6  17.8     6 167.6   123  3.92 3.440 18.90     1     0     4     4\r\n## 7  19.7     6 145.0   175  3.62 2.770 15.50     0     1     5     6\r\n```\r\n\r\n```r\r\ntbl(my_db, \"mtcars\") %>% filter(cyl %in% 6)\r\n```\r\n\r\n```\r\n## Source: sqlite 3.8.6 [my_db.sqlite3]\r\n## Error in sqliteSendQuery(con, statement, bind.data): error in statement: near \"6.0\": syntax error\r\n```\r\n\r\n```r\r\nmtcars %>%\r\n  filter(cyl %in% 6)\r\n```\r\n\r\n```\r\n##    mpg cyl  disp  hp drat    wt  qsec vs am gear carb\r\n## 1 21.0   6 160.0 110 3.90 2.620 16.46  0  1    4    4\r\n## 2 21.0   6 160.0 110 3.90 2.875 17.02  0  1    4    4\r\n## 3 21.4   6 258.0 110 3.08 3.215 19.44  1  0    3    1\r\n## 4 18.1   6 225.0 105 2.76 3.460 20.22  1  0    3    1\r\n## 5 19.2   6 167.6 123 3.92 3.440 18.30  1  0    4    4\r\n## 6 17.8   6 167.6 123 3.92 3.440 18.90  1  0    4    4\r\n## 7 19.7   6 145.0 175 3.62 2.770 15.50  0  1    5    6\r\n```\r\n"}}