1

Built a summary table, but the labels of the row groups are not showing up.

args(data)
summary1 <- list("Gender"= list("Female" 
             =~qwraps2::n_perc0(Sex==0, na_rm=TRUE))

table1 <- summary_table(data, summary1)

My table looks like this: table1:
table1

How do I get the "Gender" group name to show-up in the table?

Peter
  • 7,460
  • 2
  • 47
  • 68
Annabelle
  • 23
  • 7

2 Answers2

0

This may be related to how you "show" your table (You did not write anything about how you got it). When I use qwraps in rmarkdown in edit mode. When I just select the table (in your case table1) and press ctrl + enter I get the result you're asking for. If I use kable(table1) this removes this labelling.

I think the print() function recognized the qwrap table and prints it with the group names.

Ask a minimally reproducible example if you want more help.

Jakn09ab
  • 179
  • 9
  • I showed my table by clicking on "table1" in the "Environment" section of R studio. I tried looking at this in Rmarkdown, pressed ctrl+enter after selecting Table 1 and got this: \begin{tabular}{l|l} \hline & alagille (N = 87)\\ \hline \bf{Gender} & ~\\ \hline ~~ Female & 13 (43)\\ \hline \end{tabular} Still looking for a way to view or export as a formatted table with row groups. – Annabelle Jan 31 '19 at 00:00
  • Ok. View or export? If you use kable(table1) from library(knitr) you can export this grouped. It will not show group labels. If you just want to look at it try selecting table1 in markdown document. Not the environment and press ctrl + enter. That prints it below in markdown document nicely. I haven’t found a nice way to get this layout in the exported document. – Jakn09ab Jan 31 '19 at 04:34
0

It looks like you are viewing the table in RStuido via double clicking on the table1 in the "Environment" tab. The display is as expected. The structure of the qwraps2_summary_table object is a character matrix. In or outside of RStudio you can get the same result shown in the question post via View(table1).

To see the well rendered html you'll need to knit a .Rmd to html. Or, in RStuido you can upon a "R Notebook." A screen capture of of a simple example from an R Notebook follows:

enter image description here

Peter
  • 7,460
  • 2
  • 47
  • 68
  • I tried this, but got "Error in lapply(summaries, function(s) { : argument "summaries" is missing, with no default." Am I missing some steps? – Annabelle Mar 13 '19 at 23:05
  • @Annabelle, I have updated the screen capture. The `options(qwraps2_markup = "markdown")` needs to be set. – Peter Mar 15 '19 at 05:04
  • Thanks, @Peter. I duplicated your example in R notebook. – Annabelle Apr 04 '19 at 02:52