-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Feature request: more lenient check_nondata_cols #3835
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
Comments
I don't think the intend was ever to exclude meaningful data columns. This was just to filter out nonsensical things, such as functions. However, the question is why |
I think Below is a minimal reprex, keep in mind though that the Bioconductor S4 library(ggplot2)
setClass("fakeinteger", representation = list(x = "integer"),
prototype = list(x = integer()))
y <- new("fakeinteger", x = 1:5)
ggplot2:::check_nondata_cols(list(y = y))
#> [1] "y" Created on 2020-02-25 by the reprex package (v0.3.0) Below is a more realistic reprex for two actual bioconductor classes that behave near identical to vectors. # BiocManager::install("S4Vectors")
suppressPackageStartupMessages(library(S4Vectors))
library(ggplot2)
# Factor is a class wherein levels can be pretty much anything
x <- Factor(levels = complex(real = 1:5, imaginary = 5:1), index = 1:3)
# Rle is a run length encoded Vector that behaves like a vector,
# in contrast to base::rle
y <- Rle(rep(1:5, 5:1))
# They fail the non-data column check
ggplot2:::check_nondata_cols(list(x = x, y = y))
#> [1] "x" "y" Created on 2020-02-25 by the reprex package (v0.3.0) The |
Ok. In this case, if |
Yes, most S4 data classes in Bioconductor I know of probably inherit from
I'll go start preparing a PR! |
Are rectangular vectors a problem? We've talked about allowing data frame columns, and this wouldn't be any different I think. No need to ensure |
I don't necessarily think they are problematic. Just to check: data.frame columns are okay then? Out of curiosity, could you point me to the relevant conversation? (so I might glimpse an example) |
Yes, data frame columns are Ok: rlang::is_vector(data.frame(x = 1, y = 2))
#> [1] TRUE Created on 2020-02-25 by the reprex package (v0.3.0)
All relevant conversations happen on Twitter: https://twitter.com/hadleywickham/status/1009674367624777728?s=20 |
Closed via #3837. |
Let check_nondata_cols allow Vector class (tidyverse#3835) (tidyverse#3837)
Currently data.frame columns are dropped when they don't satisfy the checks of
check_nondata_cols
which looks like the following:The reason I would like it to be more lenient is such that vector-like columns which technically aren't vectors could be accepted, specifically for the virtual
S4Vectors::Vector-class
(and non-virtual classes containing this). This would open up channels to have Bioconductor work with ggplot2 more naturally, provided some extra infrastructure is implemented at the scale/coordinate level (which could befit a ggplot extention package).I would propose to change
check_nondata_cols
to the following:Thanks you for reading and considering!
The text was updated successfully, but these errors were encountered: