Skip to content

Environment pane won't expand contents for data frames with ALTREP columns #4758

Closed

Description

@KoningD

Hi there,

It was really hard to come up with a name of this bug. The issue is as follows: If I have a dataframe with more than one row, it is not possible to "click open" the dataframe and see the names of the variables and data types. The button simply doesn't exist.

df_one_obs <- data.frame(1,2)
df_two_obs <- data.frame(1:2, 3:4)
df_more_obs <- data.frame(1:4,5:8)

image

Sorry if this is not clear (tried my best, first time opening an issue). If there are any questions, I am happy to answer them!

Dewi

Activity

  1. ronblum commented on May 6, 2019

    @ronblum
    Contributor

    @KoningD Thank you for reporting this! I can reproduce this on MacOS 10.14 on RStudio Desktop 1.2.1335.

    No problem regarding the format. We do prefer using the template that shows up when you file a new issue, as it helps us review the bug more quickly, and it hopefully helps you with providing the needed information—and you've provided this, including a specific, helpful example of how to reproduce the issue. Besides the behavior of the bug, it's very useful to provide information about the product on which you've found the issue. I was able to reproduce it, so it's not critical, but could you add the following information? In the meantime, I'll update the subject line. Thanks!

    RStudio Edition : <!-- Desktop or Server -->
    RStudio Version : 
    OS Version      : 
    R Version       : 
    
  2. ronblum commented on May 6, 2019

    @ronblum
    Contributor

    This is a regression: it works in 1.1.463.

    df_a <- data.frame(1)
    df_b <- data.frame(1:2)
    df_c <- data.frame(1, 2)
    
  3. added this to the v1.2-patch milestone on May 6, 2019
  4. changed the title [-][bug]: RStudio IDE - environment pane not able to preview dataframe [/-] [+]Environment pane won't expand contents for data frames with multiple observations[/+] on May 6, 2019
  5. jmcphers commented on May 6, 2019

    @jmcphers
    Member

    The problem here is subtle and is due to not to multiple observations but to ALTREPs.

    > .rs.hasAltrep(df_a)
    [1] FALSE
    > .rs.hasAltrep(df_b)
    [1] TRUE
    

    In newer versions of R, when you use a sequence like 1:4, R doesn't store the whole sequence -- it instead stores an alternative representation of the sequence that is only unrolled when needed. Obviously for things like 1:4 it doesn't make a big difference, but ALTREPs can be very expensive to evaluate. For example, evaluating one can actually cause entire files to be read from disk (see https://github.com/r-lib/vroom).

    For this reason, newer versions of RStudio are careful to avoid anything that would unroll the ALTREP, and that includes generating a preview in the environment pane. See #4171 for some other discussion of the issue.

    So--technically--RStudio 1.2 is doing the right thing here by keeping those sequences from getting unrolled, whereas 1.1 is brazenly evaluating them, consequences be damned.

    I think the fix here should be to treat ALTREP data frames like we do very large data frames; the data frame preview can be deferred and loaded on demand.

  6. changed the title [-]Environment pane won't expand contents for data frames with multiple observations[/-] [+]Environment pane won't expand contents for data frames with ALTREP columns[/+] on May 6, 2019
  7. removed this from the v1.2-patch milestone on May 6, 2019
  8. Mosk915 commented on Jul 15, 2020

    @Mosk915

    We just upgraded to RStudio Server Pro Version 1.3.959-1 and are now noticing this issue. Was something changed that would cause this issue to return?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions