filter() does not accept scalar values as logical expression #217
Comments
I currently get:
@hadley should this give the same as
|
@romainfrancois yes, if the output is length one, it should apply to the entire group. |
Thanks. I'll pick it up then |
It is mostly there, however we have this test case :
which sort of suggest that |
That seems like it should be ok to me. Given the spacing around the parens, I think you probably wrote those tests ;) |
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. |
I've added some more special casing for this. Should be able now to do |
Example
gives an error
Error: unknown column : T
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
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
but it looks odd.
The text was updated successfully, but these errors were encountered: