Repository navigation
Don't strip classes in Geom$use_defaults() - #5657
Merged
Merged
Conversation
Member
|
how come row names order is affected at all? The code change doesn't do any reordering? |
Collaborator
Author
|
I think in some circumstances df <- data.frame(x = 1:2, y = 1:2)
rownames(df) <- 3:2
rownames(df)
#> [1] "3" "2"
rownames(vctrs::vec_cbind(df, !!!list(i = 3)))
#> [1] "1" "2"Created on 2024-01-22 with reprex v2.1.0 |
Member
|
gotcha |
Merged
thomasp85
pushed a commit
that referenced
this pull request
Feb 23, 2024
* Use `vec_cbind()` instead of data.frame assignment * ignore rownames in test * Add test for AsIs class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR to the RC aims to fix #5656.
Briefly, using
base::`<-.data.frame`inGeom$use_defaults()causes classes to be stripped on the RHS of the assignment.This PR uses
vec_cbind()to do the same job without stripping classes.I encountered some reordered rownames during a test, but as these are not important in ggplot2, I'm not concerned.