Skip to content
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

Nested data frames will not sort by binary indicator in Data Viewer if 1 is originally the first row instead of 0 #7562

Closed
fordholland opened this issue Aug 10, 2020 · 3 comments
Labels
bug data viewer reproducible stale Issues which have been closed automatically due to inactivitiy.

Comments

@fordholland
Copy link

@fordholland fordholland commented Aug 10, 2020

System details

RStudio Edition : Desktop
RStudio Version : 1.3.1056
OS Version      : Windows 10 version 1803
R Version       : 3.6.0
dplyr Version   : 1.0.1

Steps to reproduce the problem

  1. Run the following code:
df <- dplyr::tribble(
  ~ val, ~ tbl,
  1, dplyr::tibble(col1 = 1, col2 = 1), 
  0, dplyr::tibble(col1 = 0, col2 = 0), 
) 

View(df)
  1. Note that clicking on the data frames in the tbl column to view displays two columns with values corresponding to the indicator val:
    image
    image

  2. Sort by val so that the first row is 0:
    image

  3. Open the data frames in tbl again to find that the values no longer correspond to the indicator val.

Describe the problem in detail

When using the RStudio Data Viewer to sort nested data frames according to a binary (0 and 1) column, the column containing nested data frames will not sort if the first row of the binary column was not 0 initially.

This issue seems related but perhaps not identical to #7546.

Describe the behavior you expected

Following the steps above, the Data Viewer correctly sorts the nested data frame values after running the following, where 0 is initially the first row value:

df <- dplyr::tribble(
  ~ val, ~ tbl,
  0, dplyr::tibble(col1 = 0, col2 = 0), 
  1, dplyr::tibble(col1 = 1, col2 = 1), 
) 

View(df)

The Viewer also correctly sorts data frames when the column sorted on does not contain 0:

df <- dplyr::tribble(
  ~ val, ~ tbl,
  1, dplyr::tibble(col1 = 1, col2 = 1), 
  2, dplyr::tibble(col1 = 2, col2 = 2), 
) 

View(df)
@ronblum
Copy link
Contributor

@ronblum ronblum commented Aug 13, 2020

@fordholland Thank you for filing the issue! I can reproduce it. Note, though, that for the last example, I do see an issue—when the val column is sorted in reverse, the same problem occurs. In any case, we'll review this as we continue developing RStudio.

@stale
Copy link

@stale stale bot commented Feb 5, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

@stale stale bot added the stale Issues which have been closed automatically due to inactivitiy. label Feb 5, 2021
@stale
Copy link

@stale stale bot commented Feb 19, 2021

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug data viewer reproducible stale Issues which have been closed automatically due to inactivitiy.
Projects
None yet
Development

No branches or pull requests

2 participants