-
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
adorn_totals() attempting to add additional "Total" factor level #529
Comments
Makes sense, I can see how the change I introduced just before 2.2.0 in #494 would have caused this. And I think it's an easy fix. I can patch it but I'm curious about a workflow that calls |
I think a check of whether "name" already exists in levels prior to re-leveling at adorn_totals.R Line 137 could potentially solve the issue. Re: workflow example calling adorn_totals() twice - real life case is actually coming from joining two tables where one of them was previously subject to adorn_totals(). When adorn_totals() is applied to this new joined table, error was thrown. |
I think this will do it: #531 Indeed, I'm targeting the line you suggest. Thanks for looking through the codebase! |
@egozoglu when you get a chance can you install the latest janitor from Github and confirm that this addresses your issue? |
Thanks for the quick fix! I think this solves the issue. While testing different use cases - I saw that when adorn_totals() is called twice on the table, it also results in I think in an handled error (Line 67). While I understand this, I think there are cases where someone might want to "refresh" the totals. There might be a better way to do this, however, instead of an "error", would that be possible to convert this to a verbose "reminder" and still proceed with updating the "total" row? Example below:
|
Bug reports
adorn_totals() attempting to add additional "Total" factor level, leading to error.
adorn_totals() is attempting to add factor layer "Total" if a table was subject to adorn_totals() previously. This leads to error as "Total" layer already exist for the factor.
The text was updated successfully, but these errors were encountered: