tbl_regression problems with OR

Good evening,

I would like to ask you a question regarding the package tbl_regression. Whenever I am trying to do an OR table I see that there are some variables where OR is not calculated and instead of comparing the variables to the same factor it compares the variables with each other.

For example, do you know what I can do for having the OR of the students group in this table? (I am comparing the OR of eating healthy in different working groups)

Thank you very much.

Here you have my example

library(tidyverse)
library(dplyr)
library(tibble)
library(psych)
library(flextable)
library(Gmisc)
library(Hmisc)
library(kableExtra)
library(knitr)
library(eeptools)
library(htmlTable)
library(lubridate)
library(nnet)
library(questionr)
library(sjPlot)
library(ggpubr)
library(ggplot2)
library(gt)
library(kableExtra)
library(reprex)
library(readxl)
Cheftaste <- read_excel("C:/Users/juanp/Desktop/cheftaste/Cheftaste.xlsx", 
                        col_types = c("text", "date", "text", 
                                      "text", "text", "numeric", "text", 
                                      "numeric", "numeric", "numeric", 
                                      "text", "text", "text", "numeric", 
                                      "numeric", "numeric", "text", "text", 
                                      "text", "text", "text", "text", "text", 
                                      "text", "numeric","numeric","numeric","numeric"))



t2<-glm(Cheftaste_fan ~ Job , Cheftaste, family = binomial) %>%
  tbl_regression(exponentiate = TRUE) %>% 
  bold_p(t = 0.05) %>%
  bold_labels() %>% 
  italicize_levels()

t2
html { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif; } #cqnhaxkozx .gt_table { display: table; border-collapse: collapse; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #cqnhaxkozx .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #cqnhaxkozx .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #cqnhaxkozx .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 0; padding-bottom: 4px; border-top-color: #FFFFFF; border-top-width: 0; } #cqnhaxkozx .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #cqnhaxkozx .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #cqnhaxkozx .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #cqnhaxkozx .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #cqnhaxkozx .gt_column_spanner_outer:first-child { padding-left: 0; } #cqnhaxkozx .gt_column_spanner_outer:last-child { padding-right: 0; } #cqnhaxkozx .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; overflow-x: hidden; display: inline-block; width: 100%; } #cqnhaxkozx .gt_group_heading { padding: 8px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; } #cqnhaxkozx .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #cqnhaxkozx .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #cqnhaxkozx .gt_from_md > :first-child { margin-top: 0; } #cqnhaxkozx .gt_from_md > :last-child { margin-bottom: 0; } #cqnhaxkozx .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #cqnhaxkozx .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 12px; } #cqnhaxkozx .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #cqnhaxkozx .gt_first_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; } #cqnhaxkozx .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #cqnhaxkozx .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; } #cqnhaxkozx .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #cqnhaxkozx .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #cqnhaxkozx .gt_footnote { margin: 0px; font-size: 90%; padding: 4px; } #cqnhaxkozx .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #cqnhaxkozx .gt_sourcenote { font-size: 90%; padding: 4px; } #cqnhaxkozx .gt_left { text-align: left; } #cqnhaxkozx .gt_center { text-align: center; } #cqnhaxkozx .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #cqnhaxkozx .gt_font_normal { font-weight: normal; } #cqnhaxkozx .gt_font_bold { font-weight: bold; } #cqnhaxkozx .gt_font_italic { font-style: italic; } #cqnhaxkozx .gt_super { font-size: 65%; } #cqnhaxkozx .gt_footnote_marks { font-style: italic; font-size: 65%; }

Characteristic

OR1

95% CI1

p-value

Job

Student

Work at an office

0.65

0.34, 1.20

0.2

Work that requires an intense physical activity (Personal trainer, construction builder, etc..)

2.08

0.34, 15.9

0.4

Work that requires normal physical activity (Supermarket, Physicians, etc..)

1.39

0.56, 3.45

0.5

1

OR = Odds Ratio, CI = Confidence Interval

Created on 2020-08-13 by the reprex package (v0.3.0)

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