gtsummary

How to generate effect size [90%CI] in the summary table using R package “gtsummary”?

会有一股神秘感。 提交于 2021-01-24 09:35:29
问题 I am working on creating summary table using the R package "gtsummary". This is actually very good. The add_stat function gives you a lot of freedom to include add-ons. For example, in my area we want to inform the effect size with confidence interval (ES [90% CI]). So, I would like help to include the CI range. The code I implemented is working, but without digit control and without the CI range. # Packages ---------------------------------------------------------------- library(gtsummary)

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

痞子三分冷 提交于 2021-01-03 03:41:33
问题 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 table are presented below. I would like the label "NO2" to appear as "NO 2 ". library(tidyverse) library(gtsummary) case <- c(0,1,0,0,0,0) no2 <- c(17, 14, 8, 9, 9, 7) df <- data.frame(case, no2) mod_adj <- glm(case~no2,data=df, family="binomial")

How to output {gtsummary} tables as images?

≯℡__Kan透↙ 提交于 2020-07-19 06:01:06
问题 I am trying to output {gtsummary} tables (specifically tbl_regression() output) as images. I am using kableExtra::as_image() but the result is not very pretty. A reprex is below but I don't have the reputation to post an image. Is there a way to programmatically get an image of the tbl_regression() output? On the {gtsummary} github site, there are very nice table images in the README but I am not sure if they were created manually or with code as I don't see any functions that extracted them.

Why the function “round” does not work on the digits of p-value? and How to adjust the digits of percentage in the summary tables using “gtsummary”?

谁都会走 提交于 2020-05-13 18:11:09
问题 When I was creating a " custom pvalue function to add_p()" , I tried to adjust the digits of p-value but found that the function "round" dose not work. (see the code "result$p <- round(result$p, 3)") Besides, I found I can not change the digits of the percentage of counts numbers in the summary table. ttest1 <- function(data, variable, by, ...) { result <- list() result$p <- stats::t.test(data[[variable]] ~ data[[by]])$statistic result$p <- round(result$p, 3) result$test <- "t test" result }