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

Coerce x/y/by from character to factor #219

Merged
merged 2 commits into from
Sep 21, 2024
Merged

Conversation

zeileis
Copy link
Collaborator

@zeileis zeileis commented Sep 17, 2024

Fixes #217

Summary: In tinyplot.default the x, y, and by variables are turned into factors if they are character variables. This is done early on in the function but after all deparse1(substitute(...)) calls because the coercion would evaluate the variables obviously.

Caveat: In the modular future we might have tinyplot types which want to draw character variables in some way. As long as the type "knows" that, it's not yet a killer argument. The plot type could coerce back with as.character() and end up with the original variable. However, if that plot type would do somewhat different things for character variables and factor variables, then the design decision from this PR would prevent that.

@grantmcdermott grantmcdermott merged commit faa96ac into main Sep 21, 2024
3 checks passed
@grantmcdermott
Copy link
Owner

Thanks @zeileis!

(Also for raising the caveat. Good to keep in mind and might necessitate a was_character flag or similar down the line.)

@grantmcdermott grantmcdermott deleted the character-factor branch September 21, 2024 16:06
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I'll try to remember the next time...

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.

Should we support plt(numeric ~ character)?
2 participants