[R-pkg-devel] tibbles are not data frames
h.wickham at gmail.com
Tue Sep 26 16:06:37 CEST 2017
On Tue, Sep 26, 2017 at 8:51 AM, Pedro J. Aphalo
<pedro.aphalo at helsinki.fi> wrote:
> What I think is troublesome is that data.frame is part of the definition
> of the R language, and the expectation based on R's normal behaviour is
> that testing with is.data.frame() should be enough to ensure that an
> object can be treated as a data frame. We can think of different
> solutions for use in our packages, but the naive R user will be always
> surprised by the behaviour of tibbles because package 'tibble' breaks
> the expectations of the R language with an exception.
> I do not know what could be the best solution... though. Maybe thinking
> of tibbles as a step towards R++ or R 4 or whatever future enhanced
> version of R, in which they will replace data frames completely. Hadley
> is correct in that they are a very significant improvement to R, but the
> problem is the inconsistent behaviour.
There are basically two classes of surprise:
1) You might be surprised that [ sometimes returns a vector and
sometimes returns a data frame.
2) You might be surprised that tibbles behave differently to data
frames for this one method.
I obviously believe that 1) is the worse surprise, but others differ.
This wouldn't normally be a problem but people use tibbles with
packages written by people who don't share my belief that 1) is
surprising and dangerous.
More information about the R-package-devel