imbi-heidelberg / DescrTab2

This package provides functions to create descriptive statistics tables for continuous and categorical variables.
https://imbi-heidelberg.github.io/DescrTab2/
9 stars 7 forks source link

Group labels not printed correctly in PDF #16

Closed LukasDSauer closed 2 years ago

LukasDSauer commented 2 years ago

I am trying to add group labels using the group_labels = list() option. However, the group labels are printed erroneously. The first group gets a tag "(N=)" for specifying the number of group members, but without actually specifying the number of members. The second group does not even print this tag at all. Here is a reproducible example:

---
title: "Reprex"
author: "Author"
date: "10 2 2022"
output: pdf_document
---

```{r setup, include=FALSE}
library(DescrTab2)
library(tidyverse)
knitr::opts_chunk$set(echo = TRUE)
options(print_format="tex")
```
## R Markdown
```{r cars}
data(mtcars)
mtcars %>% select(mpg, am) %>% # mutate(QL = factor(MWS)) %>% 
   descr(., group = "am", group_labels = list("0" = "Automatic trans.", "1" = "Manual trans."),
             format_options = list(print_CI = FALSE, print_Total = FALSE, caption="Fuel efficiency depending on transmission type"))
```

This example produces the following output: Incorrect table I marked the erroneous and the missing group size tags.

jan-imbi commented 2 years ago

Works on my machine: image Which version are you using?

LukasDSauer commented 2 years ago

Downloading the latest version from GitHub did the trick. Thank you and sorry for the hustle.