You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The functions filter() and mutate() behave differently in what regards user-defined attributes.
Below is an example. Let's start by adding an attribute to a data frame:
The function filter() behaves as expected in the sense that it does not affect the attributes of the data frame (apart from row.names of course):
mtcars %>%
filter(mpg>20) %>%
attributes()
On the other hand, the function mutate() does affect the attributes of the data. Specifically, the above user-defined attribute is discarded (the other ones are unaffected):
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
lockbot
locked and limited conversation to collaborators
Apr 6, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The functions
filter()
andmutate()
behave differently in what regards user-defined attributes.Below is an example. Let's start by adding an attribute to a data frame:
We can see the attributes of this data frame:
attributes(mtcars)
The function
filter()
behaves as expected in the sense that it does not affect the attributes of the data frame (apart fromrow.names
of course):On the other hand, the function
mutate()
does affect the attributes of the data. Specifically, the above user-defined attribute is discarded (the other ones are unaffected):I think that it would be nicer if
mutate()
preserved the user-defined attributes asfilter()
does.The text was updated successfully, but these errors were encountered: