We can run R code but hide
echo=FALSE
and/orinclude=FALSE
By default, both input commands and R output are displayed:
table(gpa1$age)
##
## 19 20 21 22 23 25 26 30
## 7 48 56 26 1 1 1 1
olsres <- lm(colGPA ~ hsGPA, data=gpa1)
stargazer(olsres,type="text")
##
## ===============================================
## Dependent variable:
## ---------------------------
## colGPA
## -----------------------------------------------
## hsGPA 0.482***
## (0.090)
##
## Constant 1.415***
## (0.307)
##
## -----------------------------------------------
## Observations 141
## R2 0.172
## Adjusted R2 0.166
## Residual Std. Error 0.340 (df = 139)
## F Statistic 28.845*** (df = 1; 139)
## ===============================================
## Note: *p<0.1; **p<0.05; ***p<0.01
We can also include formulas using LaTeX syntax if we have LaTeX installed. \[\overline x = \sum_{i=1}^n x_i\]
And we can use R results inside of the text like in \(\hat\beta_1=\) 0.4824346.