Update plot.means_by_group.R to keep order of categories#451
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes a double assignment typo and converts the Category column to a factor in plot.means_by_group.R. The reviewer noted that using as.factor() will sort the categories alphabetically, potentially losing their original order. They suggested explicitly setting the factor levels using unique(trimmed$Category) to preserve the original order and drop unused levels.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Please see the Gemini suggestion, as |
That was fixed when I made the comment. I'm not sure exactly what is going on with the diff and the comments but that change was made previously (which is why I only explained why I didn't add the unique(). |
|
No, there's also a second |
It's literally a one line proposed change (2 if you count fixing the duplication in the prior line). There is not a second as.factor() and actually as.factor() strangely does not have levels as an argument so you can't even do that! Therefore my one line suggestion uses The So that's another reason why checking for duplicates is redundant. Also because |
Found the as.factor.
|
I think I found what you were talking about. |
No description provided.