Skip to content
Back to formatted view

Raw Message

Message-ID: <CAF8bMcaBf9a7=+fgmkhvQZZK4T32WP5btwhxvAbWnpZM_GuE3Q@mail.gmail.com>
Date: 2016-06-17T23:39:20Z
From: William Dunlap
Subject: row.names c(NA, -length) vs. c(NA, +length)

The default row.names on a data.frame made by the core-R data.frame
function are of the the form c(NA, -NROW(dataFrame)).  The dplyr package
has a 'data_frame' function that uses c(NA, +NROW(dataFrame)) instead.  The
tibble package also has a data_frame function, but it uses the negative
length.

As far as I can see, the positive and negative forms mean the same thing.
Is there any reason for the difference?  It makes testing a bit difficult
since all.equal() says they are the the same but identical() says they
differ.

> base::.row_names_info(dplyr::data_frame(X=101:110), 0)
[1] NA 10
> base::.row_names_info(tibble::data_frame(X=101:110), 0)
[1]  NA -10
> base::.row_names_info(base::data.frame(X=101:110), 0)
[1]  NA -10
>
> packageDescription("dplyr")$Author
[1] "Hadley Wickham [aut, cre],\n  Romain Francois [aut],\n  RStudio [cph]"
> packageDescription("tibble")$Author
[1] "Hadley Wickham [aut],\n  Romain Francois [aut],\n  Kirill M?ller [aut,
cre],\n  RStudio [cph]"
> packageDescription("base")$Author
[1] "R Core Team and contributors worldwide"


Bill Dunlap
TIBCO Software
wdunlap tibco.com

	[[alternative HTML version deleted]]