Skip to content

Treat data as list during position transformation #3002

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

Merged
merged 4 commits into from
Nov 19, 2018

Conversation

thomasp85
Copy link
Member

This PR treats the data frame in transform_position as a list for the duration of the call, speeding up ggplot_build up by some 30% for a simple faceted boxplot of mtcars

@thomasp85 thomasp85 changed the title Treat input as list Treat data as list during position transformation Nov 15, 2018
@@ -75,6 +75,8 @@ Position <- ggproto("Position",
#' @keywords internal
#' @export
transform_position <- function(df, trans_x = NULL, trans_y = NULL, ...) {
oldclass <- class(df)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to implement with a custom df_cols<- ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't found a performant data.frame setter except for unclassing and classing... If you know one then it would indeed be more pretty...

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, can you just make a comment that we're doing this for performance?

@thomasp85 thomasp85 merged commit 5e4a6ef into tidyverse:master Nov 19, 2018
@lock
Copy link

lock bot commented May 18, 2019

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/

@lock lock bot locked and limited conversation to collaborators May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants