Questions tagged [gtsummary]

Use this tag for questions about using the gtsummary package for data visualization in R.

{gtsummary} is an R package that creates presentation-ready summary and analytic tables. All package functions are fully documented on the {gtsummary} website, which also contains detailed tutorials.

Use the gtsummary tag on StackOverflow to ask questions about the usage of {gtsummary} functions, for example, how to use the customization features or inquiries on how to use custom functions within arguments.

To report bugs, please submit an issue on gtsummary's GitHub.

655 questions
5
votes
1 answer

gtsummary R package: how to remove commas when printing large numbers?

When creating a table using tbl_summary() from the gtsummary R package, the default settings will print commas for large numbers. Is it possible to remove these commas? For example, suppose I want to calculate the median and IQR for the following…
arbetj
  • 87
  • 5
5
votes
2 answers

How to generate t-value, F-value or Chi-square in the summary table using R package "gtsummary"?

I am working on creating summary table using the excellent R package "gtsummary", it really help me a lot in efficiently and accurately generating summary tables. But I wonder whether some of the statistics such as t-value, F-value, and Chi-square…
Pan Qing
  • 129
  • 6
4
votes
1 answer

Want to put digits(decimals) to ONLY the separate percentage column values in tbl_summary. Any break down tutorial on how map works?

I would want to add decimals for the percentage column only #Separate columns library(gtsummary) library(tidyverse) tbl <- c("{n}", "{p}%") %>% # iterate over these two statistics # build tbl_summary using each of the stats map( …
4
votes
1 answer

Deleting specific footnote in gtsummary

How can I delete specific footnote in the gtsummary table. For example I would to delete footnote 2 Wilcoxon rank sum test; Pearson's Chi-squared test but leave the other one. library(gtsummary) library(dplyr) trial[c("age", "grade", "trt")] %>% …
Moses
  • 1,391
  • 10
  • 25
4
votes
2 answers

How to save a gt table to either an excel or word file

After submitting my beautiful tables to a publisher, they want them in either a word or excel file. Is there a simple way to save a gt table to either format or am I better off just redoing them in excel?
Elliott Chinn
  • 117
  • 1
  • 8
4
votes
1 answer

looped tbl_regression from R script not printing for rmarkdown::render

I am using a .R script for analyses, and printing to a word document using rmarkdown::render. For formatted output I am using the gtsummary library, and as I want to loop through multiple variables I have the models within a for loop. The models…
Irene
  • 43
  • 2
4
votes
1 answer

how to get rid of leading zeros in the tables created by gtsummary package in R?

I wonder if there is an easy way to get rid of the leading zeros in the regression tables created by gtsummary package in R? I love this package for its functionality but not sure if there is an easy way to format the table to comply with APA…
veronicalm
  • 99
  • 5
4
votes
1 answer

How to include confidence intervals for proportion using {gtsummary} tbl_summary?

New to posting on StackOverflow (but not reading ), so bear over with my skills. I am using the {gtsummary} package, in particular the tbl_summary function. I would like to include a 95% confidence interval of the proportions for each of the by and…
4
votes
1 answer

Summary Table (mean + std.error) with p-values for 2-way anova

I'm trying to make a table that outputs the summary statistics for a large study that we usually analyze by 2-way anova, looking at main effects of both variables as well as an interaction. I'd like a way to run the stats quickly, and output them in…
Erin Giles
  • 73
  • 6
4
votes
1 answer

Split long gtsummary() table to n smaller tables

While creating my descriptive table with the gtsummary() package I get a very long table. Is it possible to split such a table in multiple shorter tables? With this example dataset I would like to show what I mean: library(gtsummary) # make dataset…
TarJae
  • 72,363
  • 6
  • 19
  • 66
4
votes
1 answer

R gtsummary package: How to Manipulate / Hide Rows in Summary Table

I am working on a project with gtsummary. For one of the tables, I have to build a long table listing covariables before and after the matchit process. My issue is that for all of the covariables (Obesity, for example), it reads one row, Obesity,…
neuroR
  • 53
  • 1
  • 5
4
votes
2 answers

R/gtsummary: Exclude some p-values and change the footnote

Does anyone know if it is possible exclude some p-values from the a summary table (tbl_summary() with add_p())? Also, can we change the footnote about the tests used? library(gtsummary) mtcars %>% tbl_summary(by = am) %>% add_p()
user13294558
4
votes
2 answers

How do I add subscripts to labels in tables using the gtsummary package in R?

I would like to introduce a subscript in a variable name for a regression summary table generated using tbl_regression in the R package gtsummary. Can anyone provide guidance as to how to do this? Code used to generate a table and the resulting…
3
votes
1 answer

gtsummary::tbl_uvregression for Poisson regression

I'm facing a problem when trying to implement the tbl_uvregression() for making a specific table summarizing univariable analysis I want to display for count regression with Poisson model. I've a data frame named Data, my outcome is a count…
Buczinski
  • 41
  • 4
3
votes
0 answers

Multiple comparisons with gtsummary

Since my question is similar to one that's been asked before, I'll steal the reprex (also below), for consistency's sake, from Summary Table (mean + std.error) with p-values for 2-way anova I'm curious how to integrate a post hoc means comparisons…
Brinkley
  • 31
  • 4
1
2
3
43 44