[Rd] make.unique rbind examples

Jonathan Carroll jono @end|ng |rom jc@rro||@com@@u
Mon Feb 11 11:49:42 CET 2019


The final two examples in ?make.unique do not appear to be relevant to
that function, namely

rbind(data.frame(x = 1), data.frame(x = 2), data.frame(x = 3))
rbind(rbind(data.frame(x = 1), data.frame(x = 2)), data.frame(x = 3))

both producing

  x
1 1
2 2
3 3

(identically) on R 3.4.3 and 3.5.1. Following a brief discussion on
Twitter, Rich FitzJohn [1] identified that under R 1.8.0 (circa 2003,
around the time these examples were added) the rownames for the output
of these lines was c("1", "11", "12"). This suggests that perhaps the
example was added to demonstrate behaviour which is no longer
supported.

A more relevant example might be

data.frame(x = 1, x = 2, x = 3)

producing

  x x.1 x.2
1 1   2   3

or, perhaps more in keeping with the original intention,

rbind(data.frame(x = 1, row.names = "a"), data.frame(x = 2, row.names
= "a"), data.frame(x = 3, row.names = "a"))

producing output with rownames c("a", "a1", "a2").

Regards,

- Jonathan.

[1] https://twitter.com/rgfitzjohn/status/1094885131532275712



More information about the R-devel mailing list