-
Notifications
You must be signed in to change notification settings - Fork 130
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
clean_names() support for all types #483
Conversation
with some tests and a bullet in news
Thanks for preparing this! While it's an edge case, could you please extend it so that it works with arbitrarily many dimnames (e.g. a 3D array like I would do that with lapply on the output of dimnames so that it is generic for as many dimnames as come out. |
Codecov Report
@@ Coverage Diff @@
## main #483 +/- ##
===========================================
+ Coverage 99.53% 100.00% +0.46%
===========================================
Files 23 23
Lines 1084 1088 +4
===========================================
+ Hits 1079 1088 +9
+ Misses 5 0 -5
|
Good point indeed! I re-used your case as a test, testing that the output is lowercase should be enough. My other tests were maybe a bit overkill, as I'm re-testing |
With that one last change, I think we'd be good to merge. @sfirke any other things you see? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Thanks @DanChaltiel (and @billdenney for the review). Two comments that I think are minor re: testing, if those are addressed I'm good to merge 👍
There you are, this should do 👍 As a side comment, here is a quote from the book "Advanced R":
Indeed, when you test your errors, you often rely on regexp. This means you cannot change the error/warning message as you might want. Since you already import rlang, you could swap every |
@DanChaltiel , I wish that all messages, warnings, and errors were classed, so that testing would be better, as you suggest. I've started using classed messages, warnings, and errors some of the time in my code. It is helpful. If you add classes, please make the class name start with the package name so that there is a near-zero chance of conflicts. |
Good idea on the classing of errors, Dan. Thanks for this PR and for being receptive to tweaks! I'm merging it now. |
Description
Enhance
clean_names.default()
to support all types of objects as long as they have either names or dimnames.Related Issue
fixes #481
Example
Created on 2022-05-15 by the reprex package (v2.0.1)