Minimum reproducible example: In a Posit.cloud project:
data(Cars93, package="MASS")
Cars93b <- cbind(Cars93,Cars93,Cars93,Cars93)
View(Cars93b)
The first few columns sort correctly when you click the variable name. However, if you go to the last few columns (hitting the >> ) , these no longer sort correctly when clicking the variable name.
I tried this in RStudio for Windows ("Cherry Blossom" Release (6e31ffc3, 2023-05-09) for windows) and do not observe this bug.
I taught my students that a way to make sure they have re-ordered a factor correctly (e.g., reordering the Airbag variable to (None, Driver, Driver & Passenger) rather than default alphabetical, they can sort in the Viewer window. However, in some other data sets with more variables, this quick check fails.