Skip to content

row.names c(NA, -length) vs. c(NA, +length)

1 message · William Dunlap

#
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.
[1] NA 10
[1]  NA -10
[1]  NA -10
[1] "Hadley Wickham [aut, cre],\n  Romain Francois [aut],\n  RStudio [cph]"
[1] "Hadley Wickham [aut],\n  Romain Francois [aut],\n  Kirill M?ller [aut,
cre],\n  RStudio [cph]"
[1] "R Core Team and contributors worldwide"


Bill Dunlap
TIBCO Software
wdunlap tibco.com