Questions tagged [gtsummary]
Use this tag for questions about using the gtsummary package for data visualization in R.
gtsummary
764
questions
1
vote
2
answers
31
views
Modify cells in tbl_summary table by dividing with constant
I have a table which has n and percentages in cells. I would like to divide or multiply each n by a constant, ideally while creating the table.
library(gtsummary)
df <- data.frame(
a=sample(1:4, ...
0
votes
0
answers
18
views
Adding mortality rate (/1000 patients-years) + 95CI in a tbl_regression (gtsummary) from Cox regression mode?
I used the following code:
library(survival)
library(gtsummary)
library(dplyr)
df <- data.frame(
time = sample(1:10, 20, replace = TRUE),
status = sample(0:1, 20, replace = TRUE),
age = ...
0
votes
0
answers
11
views
tbl_merge changes order of variables?
I have a question regarding modifying the order of labels in tbl_regression and tbl_merge.
This is the code and output for:
gtsummary::tbl_regression(model2,
...
1
vote
1
answer
38
views
How do I target the `gtsummary::as_gt()` columns in `gt` styling functions?
I use gtsummary::as_gt() to style summary tables using gt functions. For styling functions such as gt::cols_width() and gt::tab_style(), one needs to know how the columns of the table are named. This ...
1
vote
1
answer
28
views
Changing the number of tests to adjust for with add_q() from gtsummary package
I’m struggling to figure this out and it seems like there should be a way to do this, but I can't find a solution online.
Basically, I have three gtsummary tbl_cross() objects, and I am going to merge ...
0
votes
3
answers
58
views
Mean scores for survey responses in gtsummary
I am attempting to produce a table of weighted mean survey scores by categorical variables in gtsummary using the tbl_svysummary function.
How do I do this using survey weights, using the ...
0
votes
1
answer
48
views
Group variables into toplevel variables within tbl_summary()
I would like to manually set groups for variables inside the call to tbl_summary. A group of variables should be reported both individually and as a group.
If i had a logical variable apple and a ...
0
votes
1
answer
33
views
how to get global p for categorical variables in quantreg::rq
I am running an analysis for quantile regression evaluated at the median. Below is the code that I have used. My Education level is a 4-level data, giving me 3 p-values. I would like to get an overall ...
0
votes
2
answers
64
views
rounding to nearst 0 or 5 in n (add_n()) gtsummary outputbale
I need help in rounding the last digit to 0 or 5 in n column from add_n() in my gtsummary output table. any help is much appreciated
library(tidyverse)
library(gtsummary)
round_05 <- function(x) {
...
0
votes
0
answers
16
views
why gtsummary() hide some rows of the categorical variable
I want to generate table using gtsummary() package but it hides the categories for some factor variables.
I use the following code
library(dplyr)
library(gtsummary)
# Example data setup (simulated ...
0
votes
1
answer
51
views
rounding to nearst 0 or 5 in gtsummary outputbale
I need help in rounding the last digit to 0 or 5 in my gtsummary output table. any help is much appreciated
library(tidyverse)
library(gtsummary)
data %>%
tbl_summary(
by = hba1c,
include = -...
0
votes
1
answer
17
views
How do I order the variables displayed in table for tbl_uvregression?
I would like to make a table in gtsummary with the variables listed in this order from top to bottom:
covars <- c("age", "stage", "grade", "marker", "...
0
votes
1
answer
40
views
Is there an easy way to extend number of decimals using gtsummary?
I'm using tbl_summary of the gtsummary package and it's working smooth.
Though I realised now that the journal we are planning to publicate in requires small p-values to be reported as <0.0001. ...
1
vote
1
answer
37
views
How do I sort the output of tbl_custom_summary by row sum?
library(tidyverse)
library(gtsummary)
data <- tibble(
id = c(1,2,3,4,5),
report = c("A,B","A","B,C","A,B,C","A,B,C")) %>%
mutate(...
0
votes
0
answers
37
views
P-value in tbl_strata
I am working with a large data set, and in the following example, I would like to indent the numerical variables (Scores, Time, and Grade), bold the levels of color ("Blue", "Green"...