• Stars
    star
    217
  • Rank 182,446 (Top 4 %)
  • Language
    R
  • License
    Other
  • Created over 12 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ“¦ Generate citations for knitr markdown and html files
title author date bibliography
An introduction to knitcitations
Carl Boettiger
27 May 2014
references.bib

Build Status Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows. CRAN_Status_Badge

knitcitations

knitcitations is an R package designed to add dynamic citations to dynamic documents created with Yihui's knitr package.

Installation

Install the development version directly from Github

library(devtools)
install_github("cboettig/knitcitations")

Or install the current release from your CRAN mirror with install.packages("knitcitations").

Quick start: rmarkdown (pandoc) mode

Start by loading the library. It is usually good to also clear the bibliographic environment after loading the library, in case any citations are already stored there:

library("knitcitations")
cleanbib()

Set pandoc as the default format:

options("citation_format" = "pandoc")

(Note: The old method will eventually be deprecated. For documents using knitcitations <= 0.5 it will become necessary to set this as "compatibility").

Cite by DOI

Cite an article by DOI and the full citation information is gathered automatically. By default this now generates a citation in pandoc-flavored-markdown format. We use the inline command citep("10.1890/11-0011.1") to create this citation [@Abrams_2012].

An in-text citation is generated with citet, such as citet("10.1098/rspb.2013.1372") creating the citation to @Boettiger_2013.

Cite by URL

Not all the literature we may wish to cite includes DOIs, such as arXiv preprints, Wikipedia pages, or other academic blogs. Even when a DOI is present it is not always trivial to locate. With version 0.4-0, knitcitations can produce citations given any URL using the Greycite API. For instance, we can use the call citep("http://knowledgeblog.org/greycite") to generate the citation to the Greycite tool [@greycite2739].

Cite bibtex and bibentry objects directly

We can also use bibentry objects such as R provides for citing packages (using R's citation() function): citep(citation("knitr") produces [@Xie_2014; @Xie_2013; @Xie_2014a]. Note that this package includes citations to three objects, and pandoc correctly avoids duplicating the author names. In pandoc mode, we can still use traditional pandoc-markdown citations like @Boettiger2013 which will render as @Boettiger2013 without any R code, provided the citation is already in the .bib file we name (see below).

Re-using Keys

When the citation is called, a key in the format FirstAuthorsLastName_Year is automatically created for this citation, so we can now continue to cite this article without remembering the DOI, using the command citep("Abrams_2012") creates the citation [@Abrams_2012] without mistaking it for a new article.

Displaying the final bibliography

At the end of the document, include a chunk containing the command:

write.bibtex(file="references.bib")

Use the chunk options echo=FALSE and message=FALSE to hide the chunk command and output.

This creates a Bibtex file with the name given. Pandoc can then be used to compile the markdown into HTML, MS Word, LaTeX, PDF, or many other formats, each with the desired journal styling. Pandoc is now integrated with RStudio through the rmarkdown package. Pandoc appends these references to the end of the markdown document automatically. In this example, we have added a yaml header to our Rmd file which indicates the name of the bib file being used, and the optional link to a CSL stylesheet which formats the output for the ESA journals:

---
bibliography: "references.bib"
csl: "ecology.csl"
output:
  html_document
---

Then calling rmarkdown::render("intro.Rmd") from R on the tutorial compiles the output markdown, with references in the format of the ESA journals.

References

More Repositories

1

template

πŸ“¦ A template for my research projects, based on the R package structure
R
104
star
2

hugo-now-ui

🌐 Hugo adaptation of Now-UI from Creative Tim
CSS
98
star
3

labnotebook

πŸ““ Source code and version history for my online lab notebook
HTML
97
star
4

noise-phenomena

πŸ““ Ecology Letters review paper: Noise-driven phenomena in population biology
TeX
49
star
5

contentid

πŸ“¦ R package for working with Content Identifiers
R
44
star
6

nonparametric-bayes

πŸ““ Non-parametric Bayesian Inference for Conservation Decisions
TeX
41
star
7

s3-log-parse

Parsing access logs from S3
Python
21
star
8

quarto-hugo-material-dashboard

Adapting material-dashboard to Quarto and Hugo
SCSS
17
star
9

bad-forecast-good-decision

πŸ““ Utility provides a more meaningful measure of forecast skill than goodness-of-fit
TeX
16
star
10

socialR

functions for making R interact with social media
R
15
star
11

compendium

πŸ““ Project Name Here
12
star
12

dockermachine

Simple wrapper around docker-machine tool for creating and managing cloud instances across many providers
R
11
star
13

pdg_control

πŸ““ Pretty Darn Good Control: applications in optimal control
R
10
star
14

birddb

Import and query all of eBird locally
R
9
star
15

earlywarning

πŸ““ Methods for detecting early warning signals of critical transitions
R
9
star
16

schemar

πŸ“¦ Create Structured Data Using the Schema.org Vocabulary
R
8
star
17

berkeley-linux-config

πŸ–₯️ Linux needs are not always well documented by campus IT. Here are some solutions that worked for me, PR's welcome.
TeX
6
star
18

hugo-material

🌐 Hugo theme building on Bootstrap Material Kit
CSS
6
star
19

neonstore

πŸ“¦ A local content-based storage system for NEON data
R
6
star
20

taxalight

A lightning-fast taxonomic database store backed by LMDB
R
5
star
21

eml2

πŸ“¦ A list-based rewrite of higher-level functions from EML
5
star
22

structured-populations

πŸ“¦ Stochastic Population Dynamics in Ecology with Age and Stage Structure
C
5
star
23

codemeta

πŸ“¦ A smaller codemetar
R
5
star
24

whiskey

Jekyll-based template for Bourbon+Neat+Bitters+Refills SASS
CSS
5
star
25

decisions-vs-transients

πŸ““
TeX
4
star
26

rdftools

πŸ“¦ Common utilities for RDF. Package has helper routines only, limited stand-alone use.
R
4
star
27

mcmcTools

tools for Markov Chain Monte Carlo in R
R
3
star
28

wrightscape

πŸ“¦ Infer adaptive landscapes from phylogenetic trees
R
3
star
29

nexld

πŸ“¦ Working with NeXML as JSON-LD
R
3
star
30

cron-container

Run an R script as a cron job using Docker
Dockerfile
3
star
31

populationdynamics

πŸ“¦ Tools to simulate various population dynamics models in ecology
C
3
star
32

regimeshifts

πŸ“¦ R package providing simulations and data from ecological regime shifts
R
3
star
33

dissertation

TeX
2
star
34

minioclient

R Interface to the MINIO client
R
2
star
35

forecasts-darts-framework

Experimental example workflows with the darts framework
Jupyter Notebook
2
star
36

AdaptiveDynamics

πŸ“¦ Individual based simulations of adaptive dynamics
TeX
2
star
37

prosecutors-fallacy

πŸ““ Migrated from the prosecutor branch of my earlywarning repository
2
star
38

example-notebooks

because repos are actually better than gists
Jupyter Notebook
2
star
39

ptagir

R interface to the ptagis database of tagged fish
2
star
40

duckdbfs

Simple wrappers for duckdb to open local and remote filesystems
R
2
star
41

config

Machine confuration tweaks
2
star
42

ews-review

πŸ““ Early warning signals review mansucript
PostScript
2
star
43

pmc

πŸ“¦ Phylogenetic Monte Carlo: Quantifying Uncertainty in Phylogenetic Methods (now on CRAN)
R
2
star
44

warningsignals

πŸ““
R
2
star
45

bs-tipping

πŸ““ paper on state tipping vs bifurcation tipping
R
2
star
46

multiple_uncertainty

πŸ““
R
2
star
47

eco4cast-dashboard-material

A dashoard using my material theme
SCSS
2
star
48

prov

An index for a data store, permitting generation and querying of schema.org, prov, dcat dataset descriptions
R
2
star
49

sandbox

miscellaneous scripts and scratchpads
R
2
star
50

nimbios-transients

Example data that may or may not contain transients
PostScript
2
star
51

hugo-material-theme

🌐 Hugo port of Creative Tim Material Kit
CSS
2
star
52

piggyback-tests

πŸ—„οΈ A repository for testing the piggyback R package
1
star
53

rgbif_mcglinn

R
1
star
54

fluctuationDomains

πŸ““ Code for "Fluctuation Domains in Adaptive Evolution", published in TPB
TeX
1
star
55

forecasting-limits

πŸ““
1
star
56

bin

handy binaries
Python
1
star
57

website

SCSS
1
star
58

rdbms-tutorial

Relational Database Management System Tutorial in R
1
star
59

talks-2018-pointblue

🎀
HTML
1
star
60

openscience-whitepaper

Open Science: Balancing Individual Incentives with Common Good
TeX
1
star
61

2015

Lab notebook for 2015
HTML
1
star
62

quarto-hugo

a reprex of the bug really
HTML
1
star
63

fortran

πŸ“¦ Minimal demo for R interface to FORTRAN
C
1
star
64

debug-windows

R
1
star
65

quarto-material

CSS
1
star
66

hugo-cover-theme

A hugo theme / template based on bootstrap Cover example
HTML
1
star
67

movebank

πŸ“¦ A lightweight interface to the movebank API
R
1
star