Bug 400755 - Factor levels are displayed sorted by string sort, instead of numeric sort of levels.
Summary: Factor levels are displayed sorted by string sort, instead of numeric sort of...
Status: RESOLVED FIXED
Alias: None
Product: rkward
Classification: Applications
Component: User Interface (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: RKWard Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-06 17:20 UTC by Thomas Friedrichsmeier
Modified: 2025-09-19 14:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Friedrichsmeier 2018-11-06 17:20:02 UTC
To reproduce:
 x <- data.frame(a=letters)
 rk.edit(x)
 [click on a cell in the table]
Factor levels are shown "1:a" followed by "10:j".

Likely cause is that we are storing the level key as a string.
Comment 1 Thomas Friedrichsmeier 2018-11-06 17:22:17 UTC
Git commit 1a03828b813c0fb34067b978da9ff0afe500bb5a by Thomas Friedrichsmeier.
Committed on 06/11/2018 at 17:20.
Pushed by tfry into branch 'master'.

Limit number of factor levels to show in popup.

I was a bit too fast in calling that bug fixed, but now it should be:

M  +9    -1    rkward/misc/celleditor.cpp

https://commits.kde.org/rkward/1a03828b813c0fb34067b978da9ff0afe500bb5a
Comment 2 Thomas Friedrichsmeier 2018-11-06 18:01:55 UTC
Grr. Marked the wrong bug as fixed. Commit below was targeted at bug #380742 .
Comment 3 m.eik michalke 2018-11-06 20:11:10 UTC
(In reply to Thomas Friedrichsmeier from comment #0)
> Likely cause is that we are storing the level key as a string.

also, R 3.5 now internally uses some automatic detection of the "best" sorting algorithm to use for all kinds of things. i had to update unit test standards in one of my packages because of this. sorting character values can depend on the locale set, which if you ask me is a terrible idea if you need reliable results.
Comment 4 Justin Zobel 2022-12-02 01:22:53 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 5 Thomas Friedrichsmeier 2025-09-19 14:45:30 UTC
Git commit 50c4bd23b932b70db1b087235ae794ec689d301e by Thomas Friedrichsmeier.
Committed on 19/09/2025 at 14:44.
Pushed by tfry into branch 'master'.

Fix display order of factor levels

M  +1    -0    rkward/core/robject.h
M  +5    -5    rkward/misc/celleditor.cpp

https://invent.kde.org/education/rkward/-/commit/50c4bd23b932b70db1b087235ae794ec689d301e