insightsengineering / rtables

Reporting tables with R
https://insightsengineering.github.io/rtables/
Other
227 stars 49 forks source link

Render labels of most nested row splits as a virtual column #356

Open waddella opened 2 years ago

waddella commented 2 years ago

Example

        A   B   C 
---------------------
U
  1    
       x11 x12 x13
       x21 x22 x23
  2   
       x31 x32 x33
       x41 x42 x43
V
  1   
       x51 x52 x53
       x61 x62 x63
  2   
       x71 x72 x73
       x81 x82 x83

to

    ser  A   B   C 
-----------------------
U    1  x11 x12 x13
     1  x21 x22 x23
     2  x31 x32 x33
     2  x41 x42 x43

V    1  x51 x52 x53
     1  x61 x62 x63
     2  x71 x72 x73
     2  x81 x82 x83

where ser is a virtual column that is only present during printing (not in colpaths). In fact, the task here is to transform only the row labels visualization. Hence this can only be done via the toString method.

gmbecker commented 2 years ago

Reiterating the above, this is a transformation only of the MatrixPrintForm (ie matrix_form(tbl)) of a table, NOT of the TableTree object itself.