rgtsummary# Modifying digits in multi-line continuous summary table? {gtsummary}

I'm trying to create a multi-line summary table for a continuous variable using gtsummary, with the appropriate digits displayed per row. I have outlined my the relevant arguments in the `statistics`

and `digits`

functions, however the corresponding number of digits are not displaying correctly in the output table. (e.g., kurtosis is reading as `0`

when it should say `0.34`

)

The challenge is that all of the statistics are attached to the same variable name (in this case, `qsec`

), so I am not able to specify digit numbers per statistic to any certain variable. Any guidance would be greatly appreciated!

```
library(gtsummary)
library(psych)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
skew(mtcars$qsec)
#> [1] 0.3690453
kurtosi(mtcars$qsec)
#> [1] 0.3351142
mtcars %>%
select(qsec) %>%
tbl_summary(
type = qsec ~ "continuous2",
statistic = all_continuous() ~ c("{N_nonmiss}",
"{mean} ({sd})",
"{median} ({p25}, {p75})",
"{min}, {max}",
"{skew}",
"{kurtosi}"),
digits = all_continuous() ~ c(0,
1,
1,
0,
2,
2),
label = list(variable = ""),
missing = "always",
missing_text = "NA"
) %>%
add_stat_label(label = list(all_continuous() ~ c("N",
"Mean (SD)",
"Median (Q1, Q3)",
"Min, max",
"Skewness",
"Kurtosis")))
```

Solution

in your `statistic`

= declataration you have 10 statistics, therefore you would need as much as 10 digits declarations so as to control them all

```
#fragment
digits = all_continuous() ~ c(0,
1,1,
1,1,1,
0,0,
2,
2)
```

- Installing R on Linux: configure: error: libcurl >= 7.28.0 library and headers are required with support for https
- How to do ensembles with time series using AICc?
- planes3d expands and draws the area based on the sphere's radius
- How to extract tag code itself using R, rvest
- How to Display or Print Contents of Environment in R
- How to use Windows user credentials for proxy authentication in R/RStudio
- R reticulate specifying python executable to use
- Replace multiple Instances of a variable name in an R function and save the modified function
- Standardizing address formatting in R
- How to fix "failed to load cairo DLL" in R?
- Using grepl to filter columns names in specific range of columns
- changing the legends in ggplot2 to have groups of similar labels
- How to keep only unique rows but ignore a column?
- convert string date to R Date FAST for all dates
- Add subgroup text to plotly pie chart
- R Shiny : adjust height of DT datatable when fillContainer=TRUE,
- Why do R external pointers' "unusual copying semantics" mean they should not be used stand-alone?
- How to extract somo character after a string with a number of word which can change in R
- What does `se` stand for in geom_smooth(..., se = FALSE)?
- How to find number of rows greater than any values in R
- Align text and reduce space between text and parentheses in plotly hover info box
- Remove outer box of geom_bar plot with broken y-axis
- How to use lag/lead in mutate with an initial value?
- Is it possible to have a Shiny ConditionalPanel whose condition is a global variable?
- counting elements in one list in another list
- How to vectorize nested loops in R?
- Replace NA values with an incrementing sequence starting from the previous non-NA value
- How can I calculate the number of uniques in a row within a species matrix?
- How to perform operations on pairs of rows, based on a "distinguishing" column's values
- Mutate variable based on previous observations