-
Notifications
You must be signed in to change notification settings - Fork 132
suggestion: option to silence warnings in row_to_names #452 8000
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
Comments
I understand the desire, but I don't think that I agree with the method. The specific code is here: Lines 21 to 23 in 6cd6b8e
And, the warning is needed in most cases. If the names before cleaning are not specific, then that will cause issues if It is a fair point that we could add a single argument to silence this warning, but that becomes a slippery slope that we could add an argument to silence any warning. The My preferred method would be that we take advantage of the classed warnings and errors in |
Now moments after writing the above, I learned that rlang::warn("show this")
#> Warning: show this
rlang::warn("hide this", class="hider")
#> Warning: hide this
suppressWarnings({
rlang::warn("show this")
rlang::warn("hide this", class="hider")
},
classes="hider")
#> Warning: show this Created on 2021-08-01 by the reprex package (v2.0.0) |
(Unrelated, I found a bug in |
That would be a good solution (at least for me). |
Fascinating, I had no idea about this concept. So we'd give the warning a class, and then a user could call |
I think that it is best-practice for all warnings to be classed, but given that will cause a large number of classes to be created, I think we should be verbose in the class names so that there is no real chance for overlap. For example, the class here would be something like: "janitor_warn_row_to_names_not_unique" Where it would be a concatenation of package name, the text "warn", the function name, and a warning identifier. Unless there is an objection to this with an alternate proposal (ideally the tidyverse style guide would give an indicator, but I don't see that at https://style.tidyverse.org/error-messages.html), I'll go ahead and make the PR. (But I'm pretty swamped with work for the next week or two, so it'll be about 2 weeks before I'm likely to be able to dive in. If someone else wants to make the PR...) |
Could you consider adding an optional parameter in
row_to_names
to not warn about"Row X does not provide unique names. Consider running clean_names() after row_to_names()."
Something like
warnings = FALSE
orquiet = TRUE
.The warning text is displayed always, even if the next line is exactly
In my case, I have a script with many thousands of lines where the warnings (if any) should be thoroughly reviewed.
So this one is inadecuate.
The text was updated successfully, but these errors were encountered: