gtsummary with model regression tables

Hi,

I have been reading about gtsummary to make regression tables, also huxtable and jtools. I would like to make a table of the p-values for 6 different cell types. The cell types are the outcome variable and I want to see if the proportion of cells associated with Cases (model 1) is different when I adjust for Time of blood draw (model 2)

Model 1: lm(cellTypes ~ factor(Case_Control) + smoking score + Age + factor(Gender) + 15PCs, data = df
Model 2: lm(cellTypes ~ factor(Case_Control) + smoking score + Age + factor(Gender) + 15PCs + Time_of_blood_draw, data = df

I made the table by hand but would like to learn to make a publication-ready table.

Thanks for any tips. I would also like to know how to omit the 15 PCs when I print the table. I tried adding a vector of the covariates I wanted to include. This worked, but it wouldn´t accept Case_Control or Gender which are categorical.

Thanks for your help.

1 Like

See the FAQ: How to do a minimal reproducible example reprex for beginners for improving chances of attracting answers.

1 Like

HI @jonellevillar !

I agree with @technocrat that a reprex would be helpful. In the meantime, below is some code that may be helpful to you. In the example below, 'response' is your 'case_control' variable, 'age' and 'marker' are your 'Mono' and 'Neo' variables, and 'grade' is your gender variable.

library(gtsummary)
#> Warning: package 'gtsummary' was built under R version 4.0.4
packageVersion("gtsummary")
#> [1] '1.3.7'


tbl <-
  trial %>%
  select(age, marker, grade, response) %>%
  tbl_uvregression(
    x = response, 
    method = lm,
    formula = "{y} ~ {x} + grade"
  ) %>%
  modify_header(label ~ "**Outcome**") %>%
  modify_footnote(estimate ~ "Predictor is tumor response")


Created on 2021-03-02 by the reprex package (v1.0.0)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.