Re: [Rd] Corrupt internal row names when creating a data.frame with `attributes<-`

2021-03-01 Thread Martin Maechler
> Davis Vaughan > on Tue, 16 Feb 2021 14:50:33 -0500 writes: > This originally came up in this dplyr issue: > https://github.com/tidyverse/dplyr/issues/5745 > Where `tibble::column_to_rownames()` failed because it > eventually checks `.row_names_info(.data) > 0L` to

Re: [Rd] Corrupt internal row names when creating a data.frame with `attributes<-`

2021-02-16 Thread Davis Vaughan
This originally came up in this dplyr issue: https://github.com/tidyverse/dplyr/issues/5745 Where `tibble::column_to_rownames()` failed because it eventually checks `.row_names_info(.data) > 0L` to see if there are automatic row names, which is in line with the documentation that Kevin pointed

Re: [Rd] Corrupt internal row names when creating a data.frame with `attributes<-`

2021-02-16 Thread Bill Dunlap
as.matrix.data.frame does not take the absolute value of that number: > dPos <- structure(list(X=101:103,201:203),class="data.frame",row.names=c(NA_integer_,+3L)) > dNeg <- structure(list(X=101:103,201:203),class="data.frame",row.names=c(NA_integer_,-3L)) > rownames(as.matrix(dPos)) [1]

Re: [Rd] Corrupt internal row names when creating a data.frame with `attributes<-`

2021-02-16 Thread Kevin Ushey
Strictly speaking, I don't think this is a "corrupt" representation, given that any APIs used to access that internal representation will call abs() on the row count encoded within. At least, as far as I can tell, there aren't any adverse downstream effects from having the row names attribute

[Rd] Corrupt internal row names when creating a data.frame with `attributes<-`

2021-02-14 Thread Davis Vaughan
Hi all, I believe that the internal row names object created at this line in `row_names_gets()` should be using `-n`, not `n`. https://github.com/wch/r-source/blob/b30641d3f58703bbeafee101f983b6b263b7f27d/src/main/attrib.c#L71 This can currently generate corrupt internal row names when using