library(rmarkdown) library(knitr) ### Chunk options ### # Modify at your will # ## Text results opts_chunk$set(echo = TRUE, warning=TRUE, message=TRUE) ## Code decoration opts_chunk$set(tidy=TRUE, comment = NA, highlight = TRUE) ## Cache opts_chunk$set(cache = 2, cache.path = "output/cache/") opts_chunk$set(cache.extra = rand_seed) ## Plots opts_chunk$set(fig.path = "output/figures/") opts_chunk$set(dpi = 300, fig.align = "default") # may want 'center' sometimes # Figure format opts_chunk$set(dev='png') # e.g. choose among 'pdf', 'png', 'svg'... # may include specific dev.args as a list... see knitr help
library(knitcitations) cleanbib() cite_options(citation_format = "pandoc") if (file.exists("references.bib")) refs_from_file <- read.bibtex("references.bib", check=FALSE)
library(rmdTemplates) embed_data_html('dataset') # write name of your dataset here
library(rmdTemplates) embed_rmd_html("skeleton.Rmd") # write name of the Rmd file here
Rmarkdown is great r citep(citation("knitr"))
.
You can write all your R code in chunks here and the output will appear in the final document. For example:
cat("Hello world!")
If you put a BibTeX file with references ("references.bib") in the working directory, you can cite any of them like these: @Xie_2013. Or cite by doi, e.g. r citet("10.1098/rspb.2013.1372")
, thanks to knitcitations
package r citep(citation("knitcitations"))
.
You can even specifiy the desired format for your bibliography by including a style file ("bibliostyle.csl"). See Rstudio website for more help. You can grab many different bibliography styles here: http://citationstyles.org/.
There is a chunk in the end to provide your session info at the end of the document (useful for reproducibility). Set eval=FALSE if you don't want to include that info in your document.
devtools::sessionInfo()
write.bibtex(file="references.bib", append=file.exists("references.bib"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.