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
0
votes
2 answers

How do you include confidence intervals for proportions in gtsummary with by?

enter image description hereI have tried adding the confidence intervals in gtsummry but I get an error #>Error: Dimension of 'a1' and the added statistic do not match. Expecting statistic to be length 2. I successfully managed to add the intervals…
Moses
  • 1,391
  • 10
  • 25
0
votes
0 answers

Is there test of normality in the gtsummary package?

Want to confirm that gtsummary does not test the continuous variables to see if the data is normally-distributed. It seems like it always shows the median (IQR) and conduct non-normal comparison tests by default? Is this documented anywhere?
0
votes
1 answer

gtsummary inline statement in gt resulting in NA next to percentage

I use the inline statement in Rmarkdown from the gtsummary package. However, I get a strange result when I use it with a certain variable !! The problem happens when a variable and a level of the variable have the same level. Here is problem…
ebay
  • 109
  • 1
  • 7
0
votes
1 answer

Create a table of summary statistics (with p.value) with sub-levels (long list)

I am needing to conduct inferential analysis of a list of 21 countries comparing results (numeric variable) between gender. I have already created a pivot-long dataset with the following variables: Gender, Country, Results (numeric). I am using…
Cristiano
  • 233
  • 1
  • 9
0
votes
1 answer

Exponentiating GAM coefficients and confidence intervals using broom::tidy

I am running generalized additive models with mgcv::gam and am trying to organize my results using broom:tidy, but tidy apparently does not exponentiate coefficients or confidence intervals for GAMs, though it does for regular glm models. Is there a…
Kellan Baker
  • 375
  • 3
  • 11
0
votes
0 answers

broom::tidy() & tbl_regression() throws Error in profile.glm(object, which = parm, alpha = (1 - level)/4, trace = trace)

I ran a logistic regression as follows, and from the model object I could get coefficients by directly running the model object or via summary. However, trying to do the same with tbl_regression() function throws the error. I am not sure how to fix…
Nelly
  • 373
  • 2
  • 11
0
votes
0 answers

Error: Can't coerce element 1 from a double to a integer when try to split gtsummary table

This question has raised after clearing this question: Split long gtsummary() table to n smaller tables In essence the solved question worked properly with the example database. After applying it to my own dataframe the Error: Can't coerce element 1…
TarJae
  • 72,363
  • 6
  • 19
  • 66
0
votes
1 answer

Problem with 95% CI output - gtsummary package in R

From time to time, I've found the 95% CI outputs like so (see image below) using the gtsummary package. Sometimes I've noticed it is because it doesn't like a colon, space or apostrophe in the variable name or because there are NA's in the factor…
Adri
  • 121
  • 8
0
votes
1 answer

add a background color to the "Overall" column in gtsummary table

How can I use tab_style() to add a background color to the "Overall" column? library(gtsummary) trial %>% select(trt, age, grade, response) %>% tbl_summary(by=trt) %>% add_overall() %>% as_gt()
Eric Green
  • 7,385
  • 11
  • 56
  • 102
0
votes
0 answers

How to create Frequency table for categorical variable without gtsummary package

gender <- c("male","female","female","male",NA) test_resurt <- c("positive","negative",NA,"positive","negative") homeless <- factor(c("yes","no","yes","no","no")) df <- as.data.frame(cbind(gender,test_resurt,homeless)) df #> gender test_resurt…
HSC
  • 129
  • 6
0
votes
1 answer

How to add % in the head of tbl_summary

library(tidyverse) library(reprex) y <-c('A','B','C','A') x <-c('male','male','female',NA) df <- as.data.frame(cbind(x,y)) reprex() tbl_summary(df) Output I want to add 100% next to N=4. How can I do that?
HSC
  • 129
  • 6
0
votes
1 answer

r shiny reactive gtsummary table

After I fixed the rendering problem of {gtsummary} with your help: How to use {gtsummary} package in r shiny app !thanks to stefan again, I try to construct reactivity in my app. After construction of the summary table with {gtsummary} I would like…
TarJae
  • 72,363
  • 6
  • 19
  • 66
0
votes
3 answers

way to create summary table in R with two grouping factors

I am trying to create a summary table in R with two grouping factors based on the following data species plot type `mean(C)` 1 CA MI A -35.7 2 CA MI B -35.6 3…
Skotani1
  • 149
  • 6
0
votes
1 answer

Add Control and Cases numbers instead of add_nevent()

The following code produces an N column of "N" and "Event N" as part of the univariate regression table. I have a case control dataset and I would like to have the columns "Cases" and "Controls" giving the numbers of cases and controls instead. The…
Nelly
  • 373
  • 2
  • 11
0
votes
1 answer

gtsummary: summarizing a continuous variables by two categorical variables

I am trying to summarize a continuous variable by two categorical variables as seen below. I not able to do this correctly. I wonder if there is a way to get this with the gtsummary package. Thank…
SimRock
  • 229
  • 3
  • 10
1 2 3
43
44