vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
194 stars 15 forks source link

Subset, rbind, and cbind #346

Open J-Moravec opened 2 hours ago

J-Moravec commented 2 hours ago

Currently, this behaviour is undocumented and in some cases, unimplemented (or it returns nonsense).

I would like to:

This would allow preparing tables as chunks and adding them together, instead of having to prepare them all at once.

User Case

I am currently preparing tables for two datasets, the code for the tables (including images) is identical, since they are summarizing the table in the same way.

But without the ability to merge them, I need to do quite a lot of complex wrangling instead to force them into tinytable format and prepare everything as a single big table.

vincentarelbundock commented 2 hours ago

All of this sounds useful and sensible.

Note that there is already support for various rbind() strategy via the rbind2() S4 method. See:

https://vincentarelbundock.github.io/tinytable/vignettes/tinytable.html#combination-and-exploration

We need to use rbind2 because it allows extra arguments, whereas rbind does not (IIRC).

vincentarelbundock commented 2 hours ago

In addition, we might want to implement methods for:

J-Moravec commented 1 hour ago

All of this sounds useful and sensible.

Note that there is already support for various rbind() strategy via the rbind2() S4 method. See:

https://vincentarelbundock.github.io/tinytable/vignettes/tinytable.html#combination-and-exploration

We need to use rbind2 because it allows extra arguments, whereas rbind does not (IIRC).

Sounds like all we need to do is define custom S3 method that calls rbind2 to have nicer interface. And I need to read more on S4.

vincentarelbundock commented 53 minutes ago

I think I tried and rbind() and cbind() were not possible. It will have to be rbind2.tinytable() and cbind2.tinytable(). FWIW, I think the current interface for rbind2() is already quite "clean" and flexible.

It should be possible to define subset.tinytable() and sort_by.tinytable().