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

Hadley Wickham h.wickham at gmail.com
Tue Sep 26 17:29:41 CEST 2017

On Tue, Sep 26, 2017 at 9:22 AM, Patrick Perry <patperry at gmail.com> wrote:
> Would it be possible to change tibbles so that
> x[,1,drop=TRUE]
> returns a vector, not a data frame? I certainly find it surprising that
> tibbles ignore
> the drop argument. If tibbles respeced the drop argument, then package
> developers could rely on
> x[,1,drop=FALSE]
> or
> x[,1,drop=TRUE]
> behaving consistently, regardless of whether the argument is a tibble or a
> data.frame.

They can currently rely on x[[1]] returning alway a vector and x[, 1,
drop = FALSE] always returning a data frame whether x is a tibble or a
data frame. I personally don't believe that an additional approach
would help.

> Alternatively, would it be possible to make is.data.frame return FALSE for a
> tibble? Then
> developers that want base-R data.frame behavior can do
> if (!is.data.frame(x)) {
>     x <- as.data.frame(x)
> }

As I've said elsewhere in the thread that would effectively render
tibbles useless because they wouldn't work with many functions.



More information about the R-package-devel mailing list