summarytools icon indicating copy to clipboard operation
summarytools copied to clipboard

transpose does not show rownames if huxtable package is loaded

Open bjornerstedt opened this issue 2 years ago • 1 comments

The following example Rmarkdown is intended to show a rendering problem with transposed stats when both huxtable and summarytools packages are loaded.

```{r}
library(knitr) 
library(summarytools)
st_options(plain.ascii = FALSE, style = "rmarkdown")
```

The following chunk displays rownames (variable names)

```{r, results='asis'}
descr(iris, stats = "common", transpose = TRUE)
```

Loading huxtable displays as table without row headings. The same error occurs if huxtable is loaded before summarytools

```{r, results='asis'}
library(huxtable) 
descr(iris, stats = "common", transpose = TRUE)
```

Rendering with kable works

```{r}
kable(descr(iris, stats = "common", transpose = TRUE) )
```

I am using summarytools 1.0.0 and pander version 0.6.5. Huxtable is version 5.4.0

bjornerstedt avatar Oct 14 '21 19:10 bjornerstedt

Thx for reporting this... unfortunately I haven't had time to look into most issues for a while, hopefully some other developers can help out at some point.

dcomtois avatar May 19 '22 04:05 dcomtois

@bjornerstedt @dcomtois

This happens in R markdown documents because the output of descr(iris, stats = "common", transpose = TRUE) has class "summarytools" "data.frame", and while not loading huxtable, knitr prints this object through knitr:::knit_print.default (there is no knit_print method for any of the 2 classes of the descr output), when huxtable is loaded, the output is printed through the S3 method huxtable:::knit_print.data.frame.

Then, I do not think this is actually a summarytools issue.

iago-pssjd avatar Oct 31 '22 11:10 iago-pssjd

Thanks @iago-pssjd , I think you've got this figured out... I'll add a "known issues" section in the docs and mention this,

dcomtois avatar Nov 07 '22 03:11 dcomtois