Git Product home page Git Product logo

Comments (6)

skaltman avatar skaltman commented on August 26, 2024 1

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.

rossellhayes avatar rossellhayes commented on August 26, 2024

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.

rossellhayes avatar rossellhayes commented on August 26, 2024

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.

rossellhayes avatar rossellhayes commented on August 26, 2024

@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.

skaltman avatar skaltman commented on August 26, 2024

@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.

rossellhayes avatar rossellhayes commented on August 26, 2024

@skaltman Thank you! The PR should now be ready to go, let me know how it looks!

from ggcheck.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.