Instantly share code, notes, and snippets.

Embed
What would you like to do?
Post template for bit.ly/FellBit
---
layout: post
title: CHANGEME
tags:
- CHANGEME
categories:
- CHANGEME
---
{% include JB/setup %}
```{r setup, echo=FALSE, message=FALSE}
## Change if you want other options
require("knitr")
opts_chunk$set(fig.width=5, fig.height=5, cache=TRUE)
## Load knitcitations with a clean bibliography
library(knitcitations)
cleanbib()
cite_options(tooltip=TRUE)
## I made my own citing function since citep() doesn't work like I want to with
## urls that are not really pages themselves like part of a GitHub repo.
mycitep <- function(x, short=NULL, year=substr(date(), 21, 24), tooltip=TRUE) {
res <- tmp <- citep(x)
if(!is.null(short)) {
res <- gsub("></a>", paste0(">", short, "</a>"), tmp)
}
if(tooltip) {
res <- gsub("\\?\\?\\?\\?", year, res)
}
res <- gsub("span> ", "span>", res)
res
}
## Here's an example
# mycitep("https://github.com/lcolladotor/lcollado753", "Collado, 2013")
```
```{r bibsetup, echo=FALSE, message=FALSE, warning=FALSE}
write.bibtex(c("knitcitations" = citation("knitcitations")), file = "pkgs.bib")
bib <- read.bibtex("pkgs.bib")
```
Start post
### References
Citations made with `knitcitations` `r mycitep(bib[["knitcitations"]], "Boettiger, 2013")`.
```{r bibliography, results='asis', echo=FALSE, cache=FALSE}
## Print bibliography
bibliography()
```
### Reproducibility
```{r reproducbility}
sessionInfo()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment