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
{{ message }}
Repository navigation
Current development version breaks compatibility with scale() output, e.g. in qq-plots #2374
Supplying scale()- standardised values to e.g. the sample aesthetic for the use of qq-plots does work in the current CRAN version, however, it does not work anymore with the current GitHub version.
I looked through the NEWS.md to find any mention of a possible breaking change, but could not find anything that seemed to indicate that this change is intended.
# devtools::install_github("tidyverse/ggplot2")
library(ggplot2)
ggplot(data = mtcars, aes(sample = scale(mpg))) +
geom_qq()
# Error: Column `sample` must be a 1d atomic vector or a list
I'm aware that scale returns a 1d-matrix instead of an atomic vector, so I know I can circumvent this issue by using as.numeric(scale(mpg)), but this is simply a case of not wanting to change old code if I don't have to.
As you can see below, the difference between scale(mtcars$mpg) and as.numeric(scale(mtcars$mpg)) is that the former includes attributes (scaled:center, and scaled:scale), while the latter does not.
scale itself is actually comes from base, so I don't think it's something that can be changed here.
edit: I'm now realizing what you're saying is that sample used to be able to take a scale object. Is that correct?
library(ggplot2)
ggplot(data=mtcars, aes(sample= scale(mpg))) +
geom_qq()
#> Error: Column `sample` must be a 1d atomic vector or a list
ggplot(data=mtcars, aes(sample= as.numeric(scale(mpg)))) +
geom_qq()
Created on 2018-01-06 by the reprex package (v0.1.1.9000).
Thanks @batpigandme, yes, the whole point of my issue here is that this used to be possible as of the latest CRAN version, but it's not anymore in the current dev version.
I merely want to make sure that this breaking change (well, minor annoyance I guess) is known and intended, rather than this being an accident.
This is deliberate as ggplot2 now uses as.data.frame(tibble::as_tibble(evaled)) to construct data frames internally - this ensures that we use a consistent (and safe) of creating data frames, and avoids a set of bugs that kept arising in various forms. I think the best resolution is to advertise this in the news.
Activity
batpigandme commentedon Jan 6, 2018
As you can see below, the difference between
scale(mtcars$mpg)andas.numeric(scale(mtcars$mpg))is that the former includes attributes (scaled:center, and scaled:scale), while the latter does not.scaleitself is actually comes from base, so I don't think it's something that can be changed here.edit: I'm now realizing what you're saying is that
sampleused to be able to take a scale object. Is that correct?Created on 2018-01-06 by the reprex package (v0.1.1.9000).
jemus42 commentedon Jan 6, 2018
Thanks @batpigandme, yes, the whole point of my issue here is that this used to be possible as of the latest CRAN version, but it's not anymore in the current dev version.
I merely want to make sure that this breaking change (well, minor annoyance I guess) is known and intended, rather than this being an accident.
hadley commentedon May 1, 2018
This is deliberate as ggplot2 now uses
as.data.frame(tibble::as_tibble(evaled))to construct data frames internally - this ensures that we use a consistent (and safe) of creating data frames, and avoids a set of bugs that kept arising in various forms. I think the best resolution is to advertise this in the news.hadley commentedon May 1, 2018
Exploring a bit more - more precisely this enables ggplot2 to support list-cols at the expense of matrix-cols.
lock commentedon Oct 28, 2018
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/
Now supports list-cols at the expensive of matrix-cols