{"action":"created","issue":{"url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2730","repository_url":"https://api.github.com/repos/tidyverse/ggplot2","labels_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2730/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2730/comments","events_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2730/events","html_url":"https://github.com/tidyverse/ggplot2/issues/2730","id":338299380,"node_id":"MDU6SXNzdWUzMzgyOTkzODA=","number":2730,"title":"Strange facet_* error with column names","user":{"login":"tstev","id":7243750,"node_id":"MDQ6VXNlcjcyNDM3NTA=","avatar_url":"https://avatars3.githubusercontent.com/u/7243750?v=4","gravatar_id":"","url":"https://api.github.com/users/tstev","html_url":"https://github.com/tstev","followers_url":"https://api.github.com/users/tstev/followers","following_url":"https://api.github.com/users/tstev/following{/other_user}","gists_url":"https://api.github.com/users/tstev/gists{/gist_id}","starred_url":"https://api.github.com/users/tstev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tstev/subscriptions","organizations_url":"https://api.github.com/users/tstev/orgs","repos_url":"https://api.github.com/users/tstev/repos","events_url":"https://api.github.com/users/tstev/events{/privacy}","received_events_url":"https://api.github.com/users/tstev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-04T14:34:36Z","updated_at":"2018-07-04T14:37:58Z","closed_at":"2018-07-04T14:37:58Z","author_association":"NONE","body":"I was trying to build a `facet_grid` plot of my data when I kept encountering the following error:\r\n\r\n`Error in scale_apply(layer_data, x_vars, \"train\", SCALE_X, x_scales) : `\r\n\r\nBelow a reproducible example that tries to simulate my data. Firstly, I upgraded `ggplot` from `2.2.0` to `3.0.0` but it didn't help. While trying to figure out how to solve the issue I by chance copied the data into a reduced `data.table` with different column names. To my surprise it then did work. Seems strange to me that the column name has such influence. I was wondering if it's just a freak error on my system (`sessionInfo()` attached). Unfortunately, I cannot test on multiple systems.\r\n\r\n``` r\r\nlibrary(data.table)\r\n#> Warning: package 'data.table' was built under R version 3.4.4\r\nlibrary(ggplot2)\r\n#> Warning: package 'ggplot2' was built under R version 3.4.4\r\n\r\nset.seed(42)\r\ndat <- data.table(VALUE = sample(seq(0, 0.5, by = 0.001), 100, replace = TRUE),\r\n                  PANEL = c(\"A\",\"B\")[sample(c(1, 2), 100, replace = TRUE)])\r\nggplot(dat, aes(VALUE)) + \r\n  geom_density(trim = TRUE) +\r\n  facet_grid(. ~ PANEL)\r\n#> Error in scale_apply(layer_data, x_vars, \"train\", SCALE_X, x_scales):\r\n\r\nsetnames(dat, \"PANEL\", \"GRP\")\r\n\r\nggplot(dat, aes(VALUE)) + \r\n   geom_density(trim = TRUE) +\r\n  facet_grid(. ~ GRP)\r\n\r\nsessionInfo()\r\n#> R version 3.4.0 (2017-04-21)\r\n#> Platform: x86_64-w64-mingw32/x64 (64-bit)\r\n#> Running under: Windows 10 x64 (build 17134)\r\n#> \r\n#> Matrix products: default\r\n#> \r\n#> locale:\r\n#> [1] LC_COLLATE=English_United States.1252 \r\n#> [2] LC_CTYPE=English_United States.1252   \r\n#> [3] LC_MONETARY=English_United States.1252\r\n#> [4] LC_NUMERIC=C                          \r\n#> [5] LC_TIME=English_United States.1252    \r\n#> \r\n#> attached base packages:\r\n#> [1] stats     graphics  grDevices utils     datasets  methods   base     \r\n#> \r\n#> loaded via a namespace (and not attached):\r\n#>  [1] compiler_3.4.0  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2\r\n#>  [5] tools_3.4.0     htmltools_0.3.6 yaml_2.1.19     Rcpp_0.12.17   \r\n#>  [9] stringi_1.1.7   rmarkdown_1.10  knitr_1.20      stringr_1.3.1  \r\n#> [13] digest_0.6.15   evaluate_0.10.1\r\n```\r\n\r\n![](https://i.imgur.com/YPNsNDQ.png)\r\n\r\nCreated on 2018-07-04 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).\r\n"},"comment":{"url":"https://api.github.com/repos/tidyverse/ggplot2/issues/comments/402497502","html_url":"https://github.com/tidyverse/ggplot2/issues/2730#issuecomment-402497502","issue_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2730","id":402497502,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjQ5NzUwMg==","user":{"login":"hadley","id":4196,"node_id":"MDQ6VXNlcjQxOTY=","avatar_url":"https://avatars3.githubusercontent.com/u/4196?v=4","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"created_at":"2018-07-04T14:37:58Z","updated_at":"2018-07-04T14:37:58Z","author_association":"MEMBER","body":"Yes, unfortunately PANEL is a special variable name used internally by the facetting system."}}
{"actor":{"display_login":"hadley"}}