Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

subset argument broken for all geoms in v2 #1498

Closed
holgerbrandl opened this issue Jan 15, 2016 · 1 comment
Closed

subset argument broken for all geoms in v2 #1498

holgerbrandl opened this issue Jan 15, 2016 · 1 comment

Comments

@holgerbrandl
Copy link

The following code was working with ggplot2 v1.X but does not longer with v2

require(ggplot2)
require(plyr)

ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point(subset=.(Species=="setosa"))

The reported error is Error: Unknown parameters: subset. The same problem occurs all of all other geoms.

Digging through the ggplot sources, it seems that in R/geom-point.r:129 the subset argument becomes an element of the params list. However in R/layer.r:22 it's still a separate argument. So simply changing R/layer.r:75 to use subset = params$subset, instead of `subset = subset,' might fix the problem.

I've noticed the deprecation warning for the subset argument in R/layer.r:9. However I could not find what the new suggested way should look like. It was/is a very useful element of the ggplot API that I used to define custom DSLs (e.g. by using unevaluated layer definitions as function arguments that were internally used to build plots).

@hadley
Copy link
Member

hadley commented Jan 22, 2016

It was removed (see the news) since it was never documented.

@hadley hadley closed this as completed Jan 22, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants