Created
February 5, 2015 16:50
-
-
Save swihart/128560f46c0e0e7229c4 to your computer and use it in GitHub Desktop.
three examples from Karl Broman's Reproducible Research class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## from http://kbroman.org/Tools4RR/assets/lectures/03_knitr_Rmd.pdf | |
Tables | |
```{r kable} | |
x <- rnorm(100) | |
y <- 2*x + rnorm(100) | |
out <- lm(y ~ x) | |
coef_tab <- summary(out)$coef | |
library(kable) | |
kable(coef_tab , digits=2) | |
``` | |
```{r pander} | |
library(pander) | |
panderOptions("digits", 2) | |
pander(out, caption="Regression coefficients") | |
``` | |
```{r xtable, results="asis"} | |
library(xtable) | |
tab <- xtable(coef_tab , digits=c(0, 2, 2, 1, 3)) | |
print(tab, type="html") | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment