Skip to content
Prev 1911 / 12125 Next

[R-pkg-devel] tibbles are not data frames

David is right,

imagine an old silly code such as:

get_a.data.frame <- function(d) if("data.frame" %in% class(d)) d["a" ,]

This line of code giving you the row "a" of a data.frame could be in any
package.
No matter how ugly it is, it is technically correct and conforms to the
original definition of data.frames.

Now you have a data.frame:

foo <- data.frame(x=1:3, row.names = c("a", "b", "c"))
[1] 1

this is expected
[1]

This returns nothing, again it is expected as a matrix is not a data.frame

But here comes the tibble trouble:
# A tibble: 1 x 1
      x
  <int>
1    NA

And now the old package is broken.
Also if we tolerate this, think what would happen if this kind of practice
would scale up!
If anyone can call any classes the way they want without fulfilling the law
of inheritance we will soon be in big troubles, lost among the mutants.

Tibbles are great, data.frame are widely used, Tibbles should not be of the
class data.frame, unless tibbles start behaving as data.frame do.

Alex









On 26 September 2017 at 12:21, Stefan McKinnon H?j-Edwards <sme at iysik.com>
wrote:

  
    

Thread (48 messages)

Göran Broström tibbles are not data frames Sep 26 Stefan McKinnon Høj-Edwards tibbles are not data frames Sep 26 Alexandre Courtiol tibbles are not data frames Sep 26 Göran Broström tibbles are not data frames Sep 26 Joris Meys tibbles are not data frames Sep 26 Stefan McKinnon Høj-Edwards tibbles are not data frames Sep 26 Joris Meys tibbles are not data frames Sep 26 Gábor Csárdi tibbles are not data frames Sep 26 Göran Broström tibbles are not data frames Sep 26 Göran Broström tibbles are not data frames Sep 26 Daniel Lüdecke tibbles are not data frames Sep 26 Gábor Csárdi tibbles are not data frames Sep 26 David Hugh-Jones tibbles are not data frames Sep 26 Stefan McKinnon Høj-Edwards tibbles are not data frames Sep 26 Alexandre Courtiol tibbles are not data frames Sep 26 Joris Meys tibbles are not data frames Sep 26 Thierry Onkelinx tibbles are not data frames Sep 26 Holger Hoefling tibbles are not data frames Sep 26 CJ Yetman tibbles are not data frames Sep 26 Iñaki Ucar tibbles are not data frames Sep 26 Daniel Lüdecke tibbles are not data frames Sep 26 Pedro J. Aphalo tibbles are not data frames Sep 26 Göran Broström tibbles are not data frames Sep 26 Gábor Csárdi tibbles are not data frames Sep 26 Göran Broström tibbles are not data frames Sep 26 Jeroen Ooms tibbles are not data frames Sep 26 Hadley Wickham tibbles are not data frames Sep 26 Joris Meys tibbles are not data frames Sep 26 Hadley Wickham tibbles are not data frames Sep 26 Hadley Wickham tibbles are not data frames Sep 26 Pedro J. Aphalo tibbles are not data frames Sep 26 Hadley Wickham tibbles are not data frames Sep 26 Joris Meys tibbles are not data frames Sep 26 Göran Broström tibbles are not data frames Sep 26 Hadley Wickham tibbles are not data frames Sep 26 Joris Meys tibbles are not data frames Sep 26 Hadley Wickham tibbles are not data frames Sep 26 Jens Oehlschlägel tibbles are not data frames Sep 26 Hadley Wickham tibbles are not data frames Sep 26 John C Nash tibbles are not data frames Sep 26 Dirk Eddelbuettel tibbles are not data frames Sep 26 Duncan Murdoch tibbles are not data frames Sep 26 John C Nash tibbles are not data frames Sep 26 Jim Lemon tibbles are not data frames Sep 26 Jens Oehlschlägel tibbles are not data frames Sep 27 Jens Oehlschlägel tibbles are not data frames Sep 27 Duncan Murdoch tibbles are not data frames Sep 27 Göran Broström Summary: tibbles are not data frames Sep 29