forked from Pakillo/grateful
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
79 lines (49 loc) · 1.76 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE, eval = FALSE,
comment = "#>",
fig.path = "README-figures/"
)
```
# grateful
The goal of `grateful` is to make it very easy to cite the R packages used in any report or publication. By calling a single function, it will scan the project for R packages used, and generate a document with citations in the desired output format (Word, PDF, HTML, Markdown). Importantly, these references can be formatted for a specific journal so that we can just paste them directly into the bibliography of our manuscript or report.
## Installation
```{r eval=FALSE}
library(devtools)
install_github("Pakillo/grateful")
```
## Basic usage
Imagine a project where we are using the following packages: readr, dplyr, vegan, lme4, and ggplot2. Calling `cite_packages` will scan the project, find these packages, and generate a document with formatted citations.
```{r example, eval = FALSE}
library(grateful)
cite_packages()
```
![](example-output.PNG)
This document can also be a Word document, or PDF, or markdown. And use the citation style of a particular journal:
```{r eval = FALSE}
cite_packages(style = "ecology", out.format = "docx")
```
## Workflow
`cite_packages` is a wrapper function which internally performs the following steps:
1 Scan the project for packages
```{r}
pkgs <- scan_packages()
```
2 Get citations for each package
```{r}
cites <- get_citations(pkgs)
```
3 Create an rmarkdown document citing all these packages
```{r}
rmd <- create_rmd(cites)
```
4 Rendering the rmarkdown document to the desired output format
```{r}
render_citations(rmd, output = "html")
```