Useful Packages for RMarkdown

Pretty regression tables

Write this:

My regression results are in Table \@ref(tab:modtab).

```{r resultschunk}

library(sjPlot)
df <- read.csv('https://uoepsy.github.io/data/cognitive_experiment.csv')
mymodel <- lm(Y ~ 1 + Diagnosis * Task, data = df)
tab_model(mymodel, title="(\\#tab:modtab) THIS IS MY MODEL. NOT YOURS! GET YOUR OWN MODEL")
```

Compile to this:

My regression results are in Table 1.

library(sjPlot)
df <- read.csv('https://uoepsy.github.io/data/cognitive_experiment.csv')
mymodel <- lm(Y ~ 1 + Diagnosis * Task, data = df)
tab_model(mymodel, title="(\\#tab:modtab) THIS IS MY MODEL. NOT YOURS! GET YOUR OWN MODEL")
Table 1: THIS IS MY MODEL. NOT YOURS! GET YOUR OWN MODEL
  Y
Predictors Estimates CI p
(Intercept) 35.00 -3.05 – 73.05 0.070
Diagnosis 5.00 -12.61 – 22.61 0.570
Task 7.50 -10.11 – 25.11 0.395
Diagnosis × Task 2.50 -5.65 – 10.65 0.539
Observations 45
R2 / R2 adjusted 0.369 / 0.323