Search code examples
rhtml-tabler-markdown

Remove bold type from significant p-values when using tab_model()


How do I remove the bold type from significant p-values when using tab_model()?

This is an example table:

enter image description here

This table was made using the following code. Sample data below.

library(sjPlot)

m1 <- lm(behavior_program ~ Consistent + Social_Norms_SOB + Egoistic_SOB + Altruistic_SOB + Dislike + Change_Values + Judge + Judge_Gap, df_treat)

tab_model(m1, auto.label = TRUE, show.se = TRUE, 
      show.ci = 0.95, # 95% CI
      p.threshold = c(0.05, 0.01, 0.001), #p values
      p.style = "scientific_stars",
      title = "Table A: ", dv.labels = c("Outcome"))

Sample data:

    structure(list(behavior_program = c(5, 5, 5, 3, 3, 5, 6, 7, 5, 
6, 7, 3, 6, 4, 5, 6, 2, 4, 5, 5, 5, 6, 6, 2, 2, 5, 5, 5, 1, 5, 
1, 5, 1, 4, 2, 6, 6, 7, 6, 5, 5, 6, 5, 1, 4, 1, 6, 7, 6, 6, 3, 
4, 2, 6, 7, 6, 1, 1, 2, 2, 5, 4, 6, 3, 2, 5, 6, 1, 6, 2, 5, 3, 
2, 3, 5, 1, 2, 1, 5, 4, 5, 3, 5, 5, 5, 5, 4, 6, 2, 7, 5, 2, 5, 
4, 1, 7, 2, 2, 5, 6), Consistent = c(1, 0, 1, 1, 0, 0, 1, 1, 
1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 
0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 
0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 
1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 
1, 0, 0, 1, 1, 1, 0, 1), Social_Norms_SOB = c(6.25, 4, 5.25, 
2.75, 4.5, 4.25, 2.5, 6.25, 5, 6.5, 5.25, 2.25, 5.5, 4.5, 5.5, 
5.75, 3, 4.5, 5.75, 6.5, 4.5, 5.25, 5, 4.25, 2, 3.75, 5.5, 4.5, 
6.5, 7, 1, 4, 3, 4.25, 4, 5.25, 4.25, 4.75, 4.5, 3.75, 7, 2, 
5.5, 4, 5.25, 7, 7, 3.5, 4, 4.75, 4.75, 3, 6.5, 4.25, 3, 5.25, 
1.25, 4.25, 5.25, 4.5, 4.5, 2.75, 5.75, 4.5, 5, 4.75, 6.25, 5.75, 
6.25, 6, 5, 5.75, 4.5, 5, 4.5, 3, 2.5, 2.75, 6, 4, 5, 5, 3.75, 
5.75, 3.75, 4, 4.75, 5.75, 3, 5, 4.75, 6.5, 6.5, 4.75, 1.25, 
4, 4.75, 5, 3.75, 5.25), Egoistic_SOB = c(3.5, 6, 6, 3.75, 4.75, 
5.25, 7, 7, 4.75, 6.25, 5.5, 4, 5.5, 5, 3.75, 5.75, 3.5, 4.5, 
6.75, 6.75, 4, 6.25, 7, 2.25, 2, 4.5, 7, 3.5, 2.25, 7, 1.75, 
3.5, 4.75, 4.25, 3, 7, 6.5, 7, 7, 2.5, 7, 2, 6.5, 4, 4.5, 7, 
7, 4, 5.75, 5, 5.75, 4, 6.25, 6.75, 4, 6, 1.5, 5.25, 5.25, 4.25, 
5.75, 1, 6.5, 5, 6, 6.25, 6.25, 6.75, 6.75, 5.75, 6.75, 5.25, 
4.25, 5, 4.5, 6, 4, 4.25, 5.25, 4, 5.25, 4.75, 2.5, 6, 6.75, 
5, 5, 5.75, 5.75, 6, 4.25, 7, 7, 4.75, 5.5, 4.25, 2.75, 5, 4.25, 
7), Altruistic_SOB = c(6.66666666666667, 6, 6.66666666666667, 
3.33333333333333, 5.66666666666667, 4, 7, 7, 6, 6, 6.33333333333333, 
3.33333333333333, 5, 4.66666666666667, 5.33333333333333, 6, 3.33333333333333, 
4.33333333333333, 7, 7, 4.33333333333333, 6.66666666666667, 5.66666666666667, 
3.33333333333333, 2, 5, 7, 4, 3.66666666666667, 7, 1.66666666666667, 
4, 4.33333333333333, 5, 3.66666666666667, 7, 5.66666666666667, 
7, 5, 3.33333333333333, 7, 2, 6.33333333333333, 4, 6.33333333333333, 
7, 7, 4, 4.66666666666667, 6, 6, 4, 6, 5.66666666666667, 3.33333333333333, 
6, 1, 4.33333333333333, 4.66666666666667, 5, 5.66666666666667, 
1, 6.33333333333333, 5, 6, 6, 7, 5.33333333333333, 5.66666666666667, 
6, 7, 5.66666666666667, 4.33333333333333, 5, 7, 5.33333333333333, 
3.33333333333333, 3, 5, 4, 6.66666666666667, 5, 3.33333333333333, 
6, 3.66666666666667, 5, 5.66666666666667, 5.66666666666667, 5.66666666666667, 
6.66666666666667, 4.33333333333333, 7, 7, 3.66666666666667, 2.66666666666667, 
4.33333333333333, 3.66666666666667, 5.33333333333333, 4.33333333333333, 
7), Dislike = c(4.33333333333333, 5.33333333333333, 4.33333333333333, 
2.66666666666667, 4, 2.66666666666667, 1.33333333333333, 2, 3, 
3, 1.33333333333333, 4.66666666666667, 4, 4, 3.66666666666667, 
5.33333333333333, 5.33333333333333, 4, 3, 2, 4, 1.33333333333333, 
2.66666666666667, 6, 5, 2, 4, 5.33333333333333, 7, 2.66666666666667, 
6, 2.66666666666667, 5.33333333333333, 4.33333333333333, 4.66666666666667, 
1.33333333333333, 1.66666666666667, 2, 2.66666666666667, 4.33333333333333, 
1, 6, 4.33333333333333, 5, 4.33333333333333, 5, 4, 3.33333333333333, 
2, 2.33333333333333, 5.33333333333333, 4.66666666666667, 1.66666666666667, 
2, 5, 2.33333333333333, 6, 3.33333333333333, 5.33333333333333, 
3.66666666666667, 2, 7, 3, 3.66666666666667, 3.66666666666667, 
2, 2.33333333333333, 7, 1.33333333333333, 2, 1.66666666666667, 
3, 6, 3.33333333333333, 1.66666666666667, 3, 5, 6.33333333333333, 
3.33333333333333, 2.33333333333333, 3, 3, 4.33333333333333, 2.33333333333333, 
2.33333333333333, 2.66666666666667, 6, 3.66666666666667, 3, 1.33333333333333, 
4.66666666666667, 1, 2, 4, 3, 1.33333333333333, 3.66666666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, 4, 5, 5, 4, 4)), row.names = c(NA, 
-100L), class = c("tbl_df", "tbl", "data.frame"))

Please ignore this part. The algorithm is telling me to add more details. I am going to see if adding this sentence allows it to be posted.


Solution

  • Simply use the emph.p = FALSE argument.

    library(sjPlot)
    
    m1 <- lm(behavior_program ~ Consistent + Social_Norms_SOB + Egoistic_SOB + Altruistic_SOB + Dislike + Change_Values + Judge + Judge_Gap, df_treat)
    
    tab_model(m1, auto.label = TRUE, show.se = TRUE, 
              show.ci = 0.95, # 95% CI
              p.threshold = c(0.05, 0.01, 0.001), #p values
              p.style = "scientific_stars",
              title = "Table A: ", dv.labels = c("Outcome"),
              emph.p = FALSE)
    

    table