Skip to content
Prev 16156 / 21307 Next

[Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

Martin's comments are great.

I'll just give some technical help. The "tbl_df" S4 class is already
defined by dplyr (and more properly), so omit the call to
setOldClass(). Then, things work a bit better.
[some ugly result]
Warning messages:
1: In class(x) <- c(subclass, tibble_class) :
  Setting class(x) to multiple strings ("tbl_df", "tbl", ...); result
will no longer be an S4 object
2: In split.default(data[nest_vars], idx) :
  data length is not a multiple of split variable

I would argue that this is an issue with the tidyverse. They provide
an S4 class, which should in principle work, because S4 is compatible
enough with S3, but the use of class<-() breaks it. There may be a way
to make class()<- work in such cases. I will think about it.

The right way to do it with S4 would be to just call initialize(x,
...) in new_tibble(). They have to implement the initialize() logic
themselves using update_tibble_attrs(). S4 gives you that for free.

And there are more issues but I think this is a good example of the
difficulties.

Michael
On Thu, Feb 6, 2020 at 2:46 PM stefano <mangiolastefano at gmail.com> wrote: