Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

When filter() gets a formula object, it modifies it by reference #971

Closed
lionel- opened this issue Feb 16, 2015 · 4 comments
Closed

When filter() gets a formula object, it modifies it by reference #971

lionel- opened this issue Feb 16, 2015 · 4 comments
Assignees
Milestone

Comments

@lionel-
Copy link
Member

@lionel- lionel- commented Feb 16, 2015

This happens when we forget to add an underscore to use the non-NSE version:

my_filter <- ~ am == 1
mtcars %>% filter(my_filter)
## Error: filter condition does not evaluate to a logical vector. 

Now, my_filter contains the actual am object instead of just its name.

@astamm
Copy link

@astamm astamm commented Feb 16, 2015

I think you have to use the SE version filter_ of filter in this case.

On Feb 16, 2015, at 6:06 AM, Lionel Henry <notifications@github.commailto:notifications@github.com> wrote:

This happens when we forget to add an underscore to use the non-NSE version:

my_filter <- ~ am == 1
mtcars %>% filter(my_filter)

Error: filter condition does not evaluate to a logical vector.

Now, my_filter contains the actual am object instead of just its name.


Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_hadley_dplyr_issues_971&d=BQMCaQ&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=YY0Nl6LrGyElaL-CxD3xdZzVapE6UH4Cpr-mdEV4EX3NxhgDF5KLPTqjD9TVadjr&m=-mJH4C0D9D9xKxrIZiTnmFCsYNMArBOdNjMJR4gXmMQ&s=eZOapKcu4RIYMaB4wrCogZdLkopLAb2IZJ2RC93fZgA&e=.

@lionel-
Copy link
Member Author

@lionel- lionel- commented Feb 16, 2015

Sure, but this is no reason for filter() to mess with my formula ;-)

@hadley hadley added this to the 0.4.2 milestone May 19, 2015
@hadley hadley added this to the 0.5 milestone May 21, 2015
@hadley hadley removed this from the 0.4.2 milestone May 21, 2015
@hadley
Copy link
Member

@hadley hadley commented May 21, 2015

This isn't a crasher, so putting off until 0.5

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Jul 8, 2015

Hmm. I don't get it, since we do duplicate it in the Lazy class:

        inline SEXP expr() const {
            return Rf_duplicate(data[0]) ;
        }

romainfrancois added a commit that referenced this issue Jul 8, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants