-
Notifications
You must be signed in to change notification settings - Fork 135
Closed
Milestone
Description
I believe has_rownames() suffers from a problem in .row_names_info(type = 1):
df <- data.frame(x = 1:10)
df2 <- structure(df, .drop = FALSE)
df3 <- `attr<-`(df, ".drop", FALSE)
.row_names_info(df, type = 0)
#> [1] NA -10
.row_names_info(df2, type = 0)
#> [1] NA 10
.row_names_info(df3, type = 0)
#> [1] NA -10
.row_names_info(df, type = 1)
#> [1] -10
.row_names_info(df2, type = 1)
#> [1] 10
.row_names_info(df3, type = 1)
#> [1] -10
.row_names_info(df, type = 2)
#> [1] 10
.row_names_info(df2, type = 2)
#> [1] 10
.row_names_info(df3, type = 2)
#> [1] 10Created on 2021-02-11 by the reprex package (v0.3.0)
Specifically:
.row_names_info(df2, type = 1)
#> [1] 10In the end, I believe this is a bug in structure(), and I've added a fix to dplyr so that it does not use structure() in the problem from tidyverse/dplyr#5745 but I still believe has_rownames() could work around that quirk.
Metadata
Metadata
Assignees
Labels
No labels