Comments (6)
I think it would be easier if it was one function, but it does mess with the naming convention a bit since fill
is not technically a geom param.
It would also be nice if the function used ...
so you don't have to put the parameters in a list (like what you did with the labels functions).
from ggcheck.
Would you envision this as one function that can check both geom
params and aes
params, like uses_geom_param(p, "bar", params = list(fill = "blue"))
, or a new function to check aes
params, like uses_aes_param()
?
from ggcheck.
Looking at the documentation, it seems that the function is already a bit overloaded. It currently checks for geom_params
and stat_params
, so I don't think adding aes_params
would cause much issue.
from ggcheck.
@skaltman Currently, uses_labels()
returns a named vector if you check more than one label. uses_geom_params()
returns a single logical value indicating if all params match. Should uses_geom_params()
return a named vector as well?
library(ggcheck)
library(ggplot2)
p <- ggplot(mpg, aes(x = manufacturer, y = hwy)) +
geom_boxplot(width = 0.5, na.rm = TRUE) +
labs(x = "Manufacturer", y = "MPG")
uses_labels(p, x = "Manufacturer", y = "MPG")
#> x y
#> TRUE TRUE
uses_geom_param(p, "boxplot", width = 0.5, na.rm = TRUE)
#> [1] TRUE
Created on 2021-11-30 by the reprex package (v2.0.1)
from ggcheck.
@rossellhayes Yeah, I think a named vector would work well. It seems like it would be good if both functions worked similarly. And if uses_geom_param()
returns a named vector, you can check where exactly the student code went wrong without writing multiple calls to uses_geom_param()
.
from ggcheck.
@skaltman Thank you! The PR should now be ready to go, let me know how it looks!
from ggcheck.
Related Issues (18)
- Check facets HOT 1
- Create a basic pkgdown site
- `uses_mappings()` doesn't distinguish between strings and variables HOT 3
- Check a layer's parameters
- Add helper to test that the user submitted a ggplot2 HOT 3
- Add `uses_facet()`
- Add pattern to check for presence of label in plot HOT 6
- Rethink functions that take `...` HOT 1
- Check themes
- Add `default_param()` HOT 1
- `fail_if_not_ggplot()` tests object class before getting placeholder `.result`
- `uses_mappings(..., local_only = FALSE)` should check if mappings exist in all layers of plot
- Feature request: general `grade_this_plot()` type function
- Check coordinates
- Check scales
- Check if unnecessary aesthetic mappings are used
- Handle how a layer's geom and stat are checked
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggcheck.