Skip to content

Environemental panel: Number of observations displayed as ?? #13907

Closed

Description

@BartJanvanRossum

System details

RStudio Edition : Desktop
RStudio Version : RStudio 2023.09.2+508 "Desert Sunflower"
OS Version      : Windows 10
R Version       : 4.3.2

Steps to reproduce the problem

Create the following data.frame and check the environment panel.

d2 <- data.frame(x = 1:2, row.names = 1:2)

It will be displayed like this:
image

Describe the problem in detail

The number of observations is displayed as ?? instead of 2.

Describe the behavior you expected

The number of observations displayed as two.

Note that all the following examples give the expected result:

d1 <- data.frame(x = 1, row.names = 1L)
d2a <- data.frame(x = 1:2, row.names = c("a", "b"))
d2b <- data.frame(x = 1:2)
d3 <- data.frame(x = 1:3, row.names = 1:3)
  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on Nov 9, 2023
  2. added this to the Ocean Storm milestone on Nov 9, 2023
  3. kevinushey commented on Nov 9, 2023

    @kevinushey
    Collaborator

    Bug is here:

    // Detect compact row names
    if (TYPEOF(rowNamesInfoSEXP) == INTSXP && LENGTH(rowNamesInfoSEXP) == 2)
    {
    // Use INTEGER_OR_NULL to allow for ALTREP vectors
    // https://github.com/rstudio/rstudio/pull/13544
    const int* data = INTEGER_OR_NULL(rowNamesInfoSEXP);
    if (data != nullptr && data[0] == NA_INTEGER)
    numRows = abs(data[1]);
    }

    We need to check for NA when checking for compact row names.

  4. added and removed
    new
    on Nov 9, 2023
  5. kevinushey commented on Nov 14, 2023

    @kevinushey
    Collaborator

    I misdiagnosed the issue a bit previously. The issue here is that we try to avoid materializing so-called ALTREP vectors, which was done as part of #13544. I'll see if I can narrow down how we check duckdb here.

  6. self-assigned this
    on Nov 14, 2023
  7. jonvanausdeln commented on Nov 20, 2023

    @jonvanausdeln

    Verified with 2023.12.0-daily+313
    Windows 11, Ubuntu 22

    Number of observations are displayed correctly.

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