histry
packageTo turn on history tracking, we simply load the histry
package:
library(histry)
After this, all successfully executed top-level expressions will be tracked, both in the interactive session and within the weaving/rendering of dynamic reports by knitr
or rmarkdown
.
We now include the content of the minimal Rmd example from the knitr documentation. At the end of this vignette we will call histry()
to see that it captured all of evaluated expressions.
Start content from 001-minimal.Rmd by Yehui Xie
A quote:
Markdown is not LaTeX.
To compile me, run this in R:
library(knitr) knit('001-minimal.Rmd')
See output here.
A paragraph here. A code chunk below (remember the three backticks):
1+2 .4-.7+.3 # what? it is not zero!
It is easy.
plot(1:10) hist(rnorm(1010))
Yes I know the value of pi is r pi
, and 2 times pi is r 2*pi
.
Sigh. You cannot live without math equations. OK, here we go: $\alpha+\beta=\gamma$. Note this is not supported by native markdown. You probably want to try RStudio, or at least the R package markdown, or the function knitr::knit2html()
.
You can write code within other elements, e.g. a list
r
strsplit('hello indented world', ' ')[[1]]
Or inside blockquotes:
Here is a quote, followed by a code chunk:
r x = 1:10 rev(x^2)
end content from 001-minimal.Rmd by Yehui Xie
histry()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.