Created
June 6, 2015 14:42
-
-
Save Thell/843053aee9fcc53a7b83 to your computer and use it in GitHub Desktop.
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
--- | |
title: "testfn" | |
output: html_document | |
--- | |
```{r knitr-setup, include=FALSE, echo=FALSE} | |
library(knitr) | |
``` | |
```{r insert-fun, echo=FALSE} | |
insert_fun = function(name) { | |
read_chunk(lines = capture.output(dump(name, '')), labels = paste(name, 'source', sep = '-')) | |
} | |
``` | |
```{r insert-lm, echo=FALSE} | |
insert_fun('lm') | |
``` | |
```{r lm-source, eval=FALSE, tidy.opts=list(width.cutoff=30)} | |
``` | |
```{r lm-source, eval=FALSE, tidy=TRUE, tidy.opts=list(width.cutoff=30)} | |
``` |
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
\documentclass{article} | |
\begin{document} | |
<<insert-fun, echo=FALSE>>= | |
insert_fun = function(name) { | |
read_chunk(lines = capture.output(dump(name, '')), labels = paste(name, 'source', sep = '-')) | |
} | |
@ | |
<<insert-lm, echo=FALSE>>= | |
insert_fun('lm') | |
@ | |
<<lm-source, eval=FALSE, tidy.opts=list(width.cutoff=30)>>= | |
@ | |
<<lm-source, eval=FALSE, tidy=TRUE, tidy.opts=list(width.cutoff=30)>>= | |
@ | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment