MyNixOS website logo
Description

Cite 'R' Packages on the Fly in 'R Markdown' and 'Quarto'.

References and cites 'R' and 'R' packages on the fly in 'R Markdown' and 'Quarto'. 'pakret' provides a minimalistic API that generates preformatted citations of 'R' and 'R' packages, and adds their reference to a '.bib' file directly from within your document.

pakret

Lifecycle:experimental CRANstatus R-CMD-check

Overview

pakret is a minimalistic R package citation tool to reference and cite R and R packages on the fly in R Markdown and Quarto.

Installation

Install pakret from CRAN with:

install.packages("pakret")

Alternatively, you can install the development version of pakret from GitHub with:

# install.packages("pak")
pak::pak("arnaudgallou/pakret")

Usage

Simply use pkrt() whenever you want to cite R or an R package in your document:

---
bibliography: references.bib
---

```{r}
#| include: false
library(pakret)
```

We used `r pkrt("foo")` to extract the data.

Analyses were performed using `r pkrt("bar")`.

## References

pakret handles everything for you.

Here’s the markdown output produced by the document above:

We used the ‘foo’ package version 1.0.0 (Fastandfurius, Clausus, and
Lastopus 2020) to extract the data.

Analyses were performed using the ‘bar’ package version 0.2.0
(Itisalapsus 2024).

## References

Fastandfurius, Caius, Numerius Clausus, and Marcus Lastopus. 2020. *Foo:
Alea Jacta Est*.

Itisalapsus, Julius. 2024. *Bar: Tempus Edax Rerum*.

It’s also possible to cite a collection of packages with pkrt_list():

---
bibliography: references.bib
---

```{r}
#| include: false
library(pakret)
```

We used the following packages: `r pkrt_list("foo", "bar")`.

## References
We used the following packages: ‘foo’ v. 1.0.0 (Fastandfurius, Clausus,
and Lastopus 2020), ‘bar’ v. 0.2.0 (Itisalapsus 2024).

## References

Fastandfurius, Caius, Numerius Clausus, and Marcus Lastopus. 2020. *Foo:
Alea Jacta Est*.

Itisalapsus, Julius. 2024. *Bar: Tempus Edax Rerum*.

Unhappy with the default templates? pakret lets you define your own:

---
bibliography: references.bib
---

```{r}
#| include: false

library(pakret)
pkrt_set(pkg = "the R package :pkg (v. :ver; :ref)")
```

We used `r pkrt("foo")` to analyse the data.

## References
We used the R package foo (v. 1.0.0; Fastandfurius, Clausus, and
Lastopus (2020)) to analyse the data.

## References

Fastandfurius, Caius, Numerius Clausus, and Marcus Lastopus. 2020. *Foo:
Alea Jacta Est*.

Note that by default pakret writes new references into the first .bib file specified in the bibliography list. You can change which .bib file to save references to using pkrt_set().

Metadata

Version

0.2.2

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows