-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use vctrs internally #4868
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
Use vctrs internally #4868
Conversation
…_frame, vctrs implementation of mapped_discrete
I've come to believe that it would be most beneficial to have this PR merged in with the current scope and only bring in more vctrs functions as we find need for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my main comment is that I want to make sure you know about vctrs::new_data_frame()
. You switch from your custom new_data_frame()
over to data_frame()
in a large number of places, but I wonder if you might have been happier just getting the benefits of vctrs::new_data_frame()
instead.
In particular:
- In cases where you return an empty data frame, like
data_frame(.name_repair = "minimal")
, I thinknew_data_frame()
is cleaner new_data_frame()
doesn't do any name repair, so you don't pay that cost at all and there is no.name_repair = "minimal"
to set. So I think you could have kept some of your old code that looked likenew_data_frame(list(...))
and been pretty happy
@DavisVaughan Regarding the switch of |
Thanks for the thorough review. Regarding the Is for the comments on the |
This PR prompted a review of the use of This means that |
I think that's fine. The conclusion of a discussion on |
Supersedes #4342
Fixes #4175
This PR aims to bring the internals of ggplot2 into a state that is compliant with vctrs data types, as well as clean up the implementation different places. The aim is not to convert every base function that has a vctrs equivalent - only that which is necessary or beneficial.
Current state includes:
rbind_dfs()
in favour ofvec_rbind()
vec_cbind()
instead ofcbind()
in the places it makes sensevec_interleave()
in our owninterleave()
functionmapped_discrete
class into a vctrs based classdo.call()
torlang::inject()
(not strictly vctrs related but in line with our move to splicing lists into calls)