881 questions
0
votes
0
answers
14
views
How to translate CI to IC of the header of a in gtsummary table?
How to translate CI to IC (brazilian portuguese) of the header of a gtsummary table? Using theme_gtsummary_language() function, it doesn't work. I tried the modify_header() function too, but doesn't ...
0
votes
0
answers
85
views
How can I resolve the issue where merging objects to display "Zero rows" output with tbl_hierarchical prevents stacking with other gtsummary objects?
I‘d like the display of the table to look like this.
Therefore, I roughly divided this table into two parts:
1)Enrolled is output as a tbl_summary object.
2) Not entered/randomized uses ...
0
votes
0
answers
47
views
How to incorporate the LSMeans results from an MMRM into tbl_custom_summary and further include it in a nested table structure?
The final table format I want to achieve is as shown in the figure below.
In my understanding that creating such a table requires several steps:
1)Use tbl_wide_summary to obtain the descriptive ...
0
votes
0
answers
51
views
How to make tbl_ard_wide_summary() work for nested structures
When I use tbl_ard_wide_summary(), I find that it is incompatible with group levels. For example, after adding strata or by variables in ard_summary(), tbl_ard_wide_summary() does not work properly.
...
1
vote
1
answer
85
views
How can I keep all-zero columns in `tbl_hierarchical` nested in `tbl_strata()`?
For reporting purposes, I need to display some observations that are supposed to be in dataset but not there actually, solely within hierarchical table, this is working:
library(cards)
library(...
0
votes
1
answer
78
views
How can I filter observation per its p-value after I used `tbl_merge`?
I tried to populate a table through merge and want to filter out those rows with any p-value greater than 5%, here is an example:
library(cards)
library(gtsummary)
tbl_1 <-
tbl_hierarchical(
...
0
votes
0
answers
73
views
GTSUMMARY table customize column percentage
I am trying to generate a Lab shift table as below. The blue box has row percent & orange is column percent. I am struggling to figure out the 'green highlighted' percent.
Example code:
# Load ...
2
votes
1
answer
76
views
How to use strata total N as denominator in stratum hierarchical table?
I try to make a hierarchical table in a strata structure with header values from ADSL and values in table from ADAE, and to make an example:
# Example 1 ----------------------------------
cards::ADAE |...
2
votes
1
answer
61
views
GTSUMMARY Table with TBL_STRATA2: Zero count rows & Level ordering issue
This is a continuation of my question posted here.
I am still facing some issues with usage of tbl_summary. For code below, I have forced TRT01A, PARAMCD etc. as factors. This helps me generate ...
2
votes
2
answers
104
views
GTSUMMARY Header counts with TBL_STRATA_NESTED_STACK
I am trying to generate a summary table for multiple parameters by Treatment. Below is a sample program.
# Load packages for program execution
pkg.load <- c("gtsummary", "cards",...
0
votes
1
answer
49
views
Issues with tbl_custom_summary from gtsummary package
I want to create a table summary but want to use a custom value as the denominator in my percentage calculations. I wrote the following to divide by 25 instead of the total (17), which was working ...
0
votes
1
answer
61
views
How to further fine-tune the RTF output of gtsummary when pagination is needed?
Based on the previous solution,
Does the gtsummary package have a function that allows the exported table to include footnotes on every page?
I successfully implemented pagination for the RTF output, ...
0
votes
0
answers
33
views
Is it possible to make the output of gtsummary in TXT format as complete as it is in RTF format?
In this example, I attempted to use huxtable to output gtsummary objects to TXT format. However, the following issues seem to arise:
The table is centered, and the output includes column names such as ...
2
votes
1
answer
76
views
gtsummary tables rendering out of place in pdf
I have been using a script from a year ago, where the tables rendered in the correct places but am wondering if anything has changed with the rendering to pdf command? Just as an example, if I use:
...
2
votes
2
answers
121
views
How to borrow values as denominators from other columns in a merged table? Row-wise percentages in tbl_hierarchical
I have a table in hierarchical structure merged by different hierarchical tables, the first column present the overall values, and the rest of columns are its subset, I am looking for a way to use the ...
2
votes
1
answer
96
views
How can we add all-zero rows and columns in a table made by tbl_hierarchical?
let's just say that I have a table template, and I need to populate all the groups and values regardless of the analysis data, all-zero row or columns, I tried this way:
library(gtsummary)
...
2
votes
1
answer
74
views
Modifying Denominators for Items in tbl_hierarchical() Output
I am currently using the tbl_hierarchical() function to generator a ECG table and I'm encountering an issue where I cannot modify the denominators for each item as needed.
For example, in the table ...
1
vote
1
answer
61
views
How to modify footnote in header with multiple levels of labels?
I tried to give first level in header with label "Primary System Organ Class" a footnote:
ADAE_subset <- cards::ADAE |>
dplyr::filter(
AESOC %in% unique(cards::ADAE$AESOC)[1:5],
...
1
vote
1
answer
52
views
Does the gtsummary package have a function that allows the exported table to include footnotes on every page?
As discussed in the previous question, it seems difficult for gtsummary to include the same footnote on every page when exporting RTF using flextable; the footnote can only appear at the end of the ...
2
votes
1
answer
99
views
How to make the title of a gtsummary object correctly paginated and left-aligned when exporting using officer/flextable?
I have two main questions here. The first is how to control the alignment of the title specified in modify_caption so that it is displayed left-aligned when exporting to RTF using flextable/officer. ...
1
vote
1
answer
55
views
Using GTSUMMARY for unique SUBJECT counts
I am trying to create an AE table, where each of the rows need unique subject counts - but may not necessarily be nested. I tried using tbl_hierarchical to achieve this. This is not exactly the ...
0
votes
0
answers
57
views
How to remove percentage from overall_row from tbl_hierarchical output?
Here is a reproducible example:
library(cards)
library(gtsummary)
ADAE_subset <- cards::ADAE |>
dplyr::filter(
AESOC %in% unique(cards::ADAE$AESOC)[1:5],
AETERM %in% unique(cards::...
1
vote
1
answer
52
views
Denominator in tbl_hierarchical tables with tbl_merge
Here is a simple example:
library(cards)
library(gtsummary)
adsl <- cards::ADSL %>%
dplyr::mutate(
SAFFL = dplyr::if_else(SAFFL == "Y", "Y", NA_character_),
ITTFL =...
0
votes
0
answers
72
views
Add difference for each level of factor variable in gt_summary
Consider the following example:
library(gtsummary)
packageVersion("gtsummary")
mean_diff <- function(data, variable, by, ...) {
if(class(data[[by]]) != "factor") {
print(...
2
votes
1
answer
72
views
tbl_summary report the z statistic for the Wilcoxon two-sample test
Following my previous question, consider:
df <- Rdatasets::rddata("military_tbl_df", package="usdatasets")
df$wage <- rnorm(nrow(df), mean = 50000, sd = 10000)
df |>
...
1
vote
1
answer
44
views
tbl_summary add column with test statistic
Consider the tbl_summary example:
trial |>
tbl_summary(by = trt, include = c(age, grade)) |>
add_p()
How can I add a column with the test statistic the p-value refers to?
In my field it ...
1
vote
1
answer
94
views
Anyway to do `tbl_hierarchical`-like analysis table in call of `tbl_summary`?
Here is an example:
library(cards)
library(gtsummary)
adsl <- cards::ADSL
tbl <- tbl_summary(
data = adsl,
by = ARM,
include = c(AGE, SEX, RACE),
type = all_continuous() ~ "...
0
votes
0
answers
59
views
Newline in GT table, rendered in word
I have some table cells in a GT table I would like to have a new line in. Works great when output to html but when I tried docx the newlines are not showing up. MWE:
---
title: "Testing docx ...
2
votes
1
answer
93
views
Convert GTSUMMARY object to FLEXTABLE
I am trying to convert gtsummary to flextable using as_flex_table. It works by default passing on information from table body. Example code is provided below:
# Load packages for program execution
pkg....
3
votes
1
answer
90
views
How can I make sure to display "zero rows" when using gtsummary::tbl_hierarchical?
I want to count serious adverse events per subject per treatment arm, and display the occurrence for each preferred term (PT) within the corresponding system organ class (SOC). For this, I take the ...
1
vote
2
answers
115
views
How to add specific line to a gt table
This is a follow up question to this.
Background: I’m trying to mimic the table format used in the DCR journal.
In my gt table I only want 3 lines as shown here (my desired output):
To achieve this I ...
5
votes
2
answers
108
views
How to set the color of line in modify_spanning_header()
This code from here:
# install.packages("gtsummary")
library(gtsummary)
trial |>
tbl_summary(by = trt, includ = c(age, grade)) |>
add_p(pvalue_fun = label_style_pvalue(digits = 2))...
0
votes
1
answer
46
views
Removing the default superscript from column in gtsummary
I reviewed the previous question someone asked on this topic but this was on an earlier version of gtsummary (2.1.0) and this is version 2.3.0, I have not been able to find a solution.
My problem is ...
0
votes
0
answers
30
views
Getting prevalences with their 95% wilson CIs using the gt_summary()
Can I use the gt_summary tbl_strata to calculate prevalences and their wilson 95% CIs?
tbl1 <- tbl_strata(
data = interestbd_df,
strata = still_births,
.tbl_fun = ~tbl_summary(
.,
...
2
votes
2
answers
89
views
GTSUMMARY - Extract ARD & ARS json
I am generating a table with spanned header that requires tbl_merge. My code is as follows:
# Load data
advs <- pharmaverseadam::advs %>%
filter(SAFFL == "Y" & VSTESTCD %in% c('...
6
votes
1
answer
126
views
How to disable formatting of fractions in tbl_summary?
Fractions are being formatted within my tables and I do not know how to disable this formatting.
library(tidyverse)
library(gtsummary)
tibble(x= LETTERS[sample(1:5,24,replace=TRUE)],
y = rep(c(...
1
vote
2
answers
67
views
GTSummary producing incorrect percentages for rows in 'Overall' column that include 'Missing'
I'm outputting a simple table with the following GTSummary code:-
# Define the data:-
df <- data.frame(pat = c(1:90))
df$by <- ifelse(df$pat < 30, "A", "B")
df$lvl <- ...
3
votes
1
answer
98
views
include NA counts of `by` variable in `tbl_summary()` but **exclude** from row %?
In gtsummary::tbl_summary(), I'm trying to show the number of NAs in the column (by) variable, without including them in the denominator of row %s.
Just displaying counts in the "Missing" ...
1
vote
1
answer
58
views
Can a paired test table be presented using tbl_cross while applying a customized McNemar's method in add_p?
I also noticed the previous response suggesting the use of tbl_summary for McNemar's test.
How to use McNemar's test in gtsummary table?
However, from my perspective, using tbl_cross to present ...
2
votes
1
answer
106
views
Overall percentages based on total count
Using tbl_summary function from the gtsummary package, I get the below table:
df <- as.data.frame(penguins)
df %>%
tbl_summary(by = species,
include = everything(),
...
0
votes
0
answers
60
views
Function as_flex_table() Corrupting Word File when Knitting
The function as_flex_table() is causing my Word files to be corrupted when I knit to Word using R Markdown, despite the code running fine within R Studio.
The following code knits to Word with no ...
1
vote
1
answer
57
views
After adding the customize method in add_difference for tbl_summary, a display issue with the confidence interval occurred
As shown below, when I want to present both conf.low and conf.high simultaneously, the results of low and high will be automatically combined under low, while high is still retained.
library(gtsummary)...
1
vote
1
answer
112
views
How to generate a table calculates patient-years at risk& incidence rate per 100 patient-years, grouped by SOC/PT
I can try to create this kind of complex nested structure table using gt, where each treatment contains multiple pieces of information. However, it seems relatively difficult to achieve this using ...
0
votes
0
answers
64
views
Issue with tbl_svysummary handling of missing data
While using tbl_svysummary, an error is thrown if the source data has missing values, whereas in tbl_summary, a simple warning is thrown (and the filtering of the missing data done in background)
...
2
votes
3
answers
77
views
How to get summary statistics on the bottom rows of a merged regression table?
I am playing the {gtsummary} package and want to have a merged regression table of a baseline and an interaction model. For both models I want to add the R-squared and the log-likelihood as the bottom ...
0
votes
0
answers
49
views
Unable to Auto-number my tables created using gtsummary using R Markdown
I'm using gtsummary in a Bookdown project and trying to get my table captions to show up with auto-numbering (e.g., "Table 1: Patient Characteristics"). I followed the usual approach by ...
0
votes
0
answers
17
views
gtsummary tbl_summary to gt no longer functioning
Following error message comes up when trying to convert tbl_summary to gt_tbl
** Examples
Example 1 ----------------------------------
trial |> tbl_summary(by = trt, include = c(age, grade, ...
1
vote
1
answer
106
views
Summary of cumulative incidence for multiple variables using tidycuminc
I want to generate a summary table of cumulative incidence estimates for several variables at once in a competing risks scenario using the tidycmprk package. It is possible to produce such a table for ...
0
votes
0
answers
146
views
Flextable corrupts .docx when knitted/printed from .rmd/.qmd
I am producing a corrupted .docx when including flextable in my workflow.
The below examples have previously worked.
I updated most packages and environments (VS code) and pandoc. I cannot quite ...
2
votes
1
answer
70
views
Set operations with selection helpers
I'm trying to select only certain variables to display as single row within a tbl_regression.
The current result is
I was using the simple input below:
database = data.frame(
INDIV_AGE = rnorm(100, ...