Join GitHub today
filter() does not accept scalar values as logical expression #217
gives an error
Or lightly different error for:
Error: incompatible expression in filter
In fact what I would want to do is to filter groups by using a scalar logical expression per group. The corresponding ddply code would be
ddply(mtcars, .(cyl), function(x) subset(x, min(mpg)>20))
which gives just those groups with the same cylinder-count where all cars of the group run at least 20 mpg.
subset() also allows for scalar expressions but can not do it in a grouped way.
Currently I have to force vectorized logical expressions to coinvince filter() to work
filter(group_by(mtcars, cyl), min(mpg)>rep(20, length(mpg))
but it looks odd.
I currently get:
@hadley should this give the same as
It is mostly there, however we have this test case :
which sort of suggest that
Thanks a ton. Amazing how fast you did it. I've just installed it via devtools and filter(mtcars, TRUE) and my actual use-cases work nicely now. However (just fyi), filter(mtcars, T) still dies with an "Error: unknown column : T". T seems to be different from TRUE in filter().
Thanks for the quick fix again.