Skip to content
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

Ignore differences between ggplot2 arguments like color vs. colour in code_feedback() #353

Merged
merged 13 commits into from
May 17, 2023

Conversation

rossellhayes
Copy link
Contributor

@rossellhayes rossellhayes commented May 17, 2023

call_standardise_formals() now applies ggplot2::standardise_aes_names() to all arguments of ggplot2 functions. This means it no longer detects inconsequential differences between e.g. color = vs colour =

library(gradethis)
library(ggplot2)

code_feedback(
  "ggplot(mpg, aes(displ, hwy, color = class)) + geom_point()",
  "ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point()"
)
#> NULL

Created on 2023-05-16 with reprex v2.0.2

Closes #342.

…are lists

Previously, this would also be applied to `pairlists`, which could mess up the standardization of function definitions, because a function's formal arguments are stored as a pairlist
…tandardize arguments to all calls, not just top-level calls
…nctions (e.g. convert `color =` to `colour =`)
Copy link
Contributor

@nischalshrestha nischalshrestha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@rossellhayes rossellhayes merged commit 7c0a4e4 into main May 17, 2023
11 checks passed
@rossellhayes rossellhayes deleted the feat/standardize-color-colour branch May 17, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add special handling for color vs. colour in automated code grading
2 participants