Skip to content

can' t sort on multiple columns in data viewer #1691

Closed

Description

@BenoitLondon

I tried shift and click but it just select the column (the arrow turns blue) but no sorting occurs.
For example here I sorted by column "a" decreasing then wanted to sort by "c" column but nothing happens apart the arrow becoming blue

View(data.frame(a = rep(1:4, each = 3), b = 1:3, c = 1:2))

image

I use the Fedora build by the way on SLED Rstudio version 1.1.383

Activity

  1. dfalty commented on Oct 30, 2017

    @dfalty

    I'm able to reproduce this on the latest daily as well 1.2.140-3.

  2. Chesster1883 commented on Oct 17, 2019

    @Chesster1883

    Still able to replicate this bug using RStudio v1.2.5001 on Windows with the following:

    View(iris)
    Sort of Sepal.Length
    Shift click to sort on Sepal.Width

  3. added this to the v1.4 milestone on Apr 15, 2020
  4. dfalty commented on Jun 18, 2020

    @dfalty

    @adamconroy I'm seeing somewhat unexpected behavior with the sorting. (1.4.484)

    First, I don't know if it's just me, but based on the order of clicking I would assume the same order of sorting. For example...
    View(data.frame(a = rep(1:4, each = 3), b = 1:3, c = 1:2))
    If I first click on A and then shift-click on B, I would expect first to be sorted by A THEN sorted by B. It does the opposite in this case. This is what I first expected when playing with it but I'd be willing to accept it if others think differently.

    I then tried out using it to sort more than two columns and that's where I got really confused. Example...
    View(data.frame(a = rep(1:4, each = 3), b = 1:3, c = 1:2))

    1. Click column A
      A column sorted first
    2. Shift click column B
      B column sorted first then column A
    3. Shift click column C
      C column sorted first then A then B

    I would expect it to go in reverse order C B A instead of C A B if we are going backward. Is this expected? Hopefully, this makes sense!

  5. adamconroy commented on Jun 18, 2020

    @adamconroy
    Contributor

    @dfalty unfortunately the way that the sorting works is up to the R sorting algorithm. I spent a fair amount of time going back and forth with Hadley other R folk and just to get any manner of multisort. I agree it feels a bit wonky. I'll make an additional issue for making this feel better but it's going to require some extra effort. I found it kind of funny how tricky this is to do in R considering the primary purpose of R is data manipulation/analysis. 🤣

    This was a case of "it didn't work at all before, now at least it kind of works" so we have something now but it should be improved.

  6. dfalty commented on Jun 18, 2020

    @dfalty

    Gotcha, thanks for the explanation. In that case, it's working as designed :)

  7. astraetech commented on Aug 24, 2022

    @astraetech

    Hi,

    Is there any tutorial for this? I spent 5 minutes shift-clicking on headers and still not getting a double sort on two columns: 1 Character (ascending) 2. Numeric. (ascending)

    Thank you

  8. ronblum commented on Aug 25, 2022

    @ronblum
    Contributor

    @astraetech What version of RStudio, R, and operating system are you using? I just tried it in RStudio Desktop RStudio-2022.07.1+554 and RStudio-2022.11.0-daily+135 on MacOS 13 as a starting point, and I'm able to get multiple column selection with Shift-Click.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions