SkillAgentSearch skills...

Cffr

Generate Citation File Format (cff) Metadata for R Packages

Install / Use

/learn @ropensci/Cffr

README

<!-- README.md is generated from README.qmd. Please edit that file -->

cffr <a href="https://docs.ropensci.org/cffr/"><img src="man/figures/logo.png" alt="cffr website" align="right" height="139"/></a>

<!-- badges: start -->

CRAN-status CRAN-results Downloads R-CMD-check codecov r-universe CITATION-cff DOI Project Status: Active - The project has reached a stable, usable
state and is being actively
developed. GitHub code size in
bytes peer-review

<!-- badges: end -->

cffr provides utilities to generate, coerce, modify, and validate CITATION.cff files automatically for R packages, along with tools and examples for working with .cff files more generally.

What is a CITATION.cff file?

Citation File Format (CFF) (Druskat et al. 2021) (v1.2.0) files are plain text files with human- and machine-readable citation information for software (and datasets). Code developers can include them in their repositories to let others know how to correctly cite their software.

This format is gaining popularity within the software citation ecosystem. Recently, GitHub, Zenodo, and Zotero have fully supported this citation format (Druskat 2021). GitHub support is of special interest:

<figure>

<img src="vignettes/tweet-1.png" class="mx-auto d-block" data-fig-align="center" width="400" />

<figcaption class="blockquote-footer">Nat Friedman (@natfriedman) July 27, 2021</figcaption> </figure>

See Enhanced support for citations on GitHub (Smith 2021) for more information.

Related projects

The CodeMeta Project (Jones et al. 2017) creates a concept vocabulary that can be used to standardize the exchange of software metadata across repositories and organizations. One of the many uses of a codemeta.json file (created following the standards defined by The CodeMeta Project) is to provide citation metadata such as title, authors, publication year, and venue (Fenner 2021). The packages codemeta (Boettiger and Salmon 2021) and codemetar (Boettiger and Salmon 2026) allow for generating codemeta.json files from R package metadata.

The cffr package

cffr maximizes data extraction by utilizing both the DESCRIPTION file and the CITATION file (if present) from your package. Note that cffr works best if your package passes R CMD check/devtools::check().

As per 2026-04-08 there are at least 520 repos on GitHub using cffr. Check them out here.

Installation

Install cffr from CRAN:

install.packages("cffr")

You can install the developing version of cffr with:

remotes::install_github("ropensci/cffr")

Alternatively, you can install cffr using the r-universe:

# Install cffr in R:
install.packages(
  "cffr",
  repos = c("https://ropensci.r-universe.dev", "https://cloud.r-project.org")
)

Example

Most commonly, from within your package folder, you’ll simply run cff_write(), which creates a cff object, writes it to a CITATION.cff file, and validates it in a single command:

library(cffr)

# For in-development packages
cff_write()
#>
#> CITATION.cff generated
#>
#> cff_validate results-----
#> Congratulations! This .cff file is valid

However, cffr also provides custom print methods and mechanisms that allow you to customize the CITATION.cff and integrate it into your workflows.

This is a basic example which shows you how to create a cff object (see ?cff for more info). In this case, we are creating a cff object from the metadata of the rmarkdown package:

library(cffr)

# Example with an installed package
test <- cff_create("knitr")
<details> <summary>

<code>CITATION.cff</code> for <strong>knitr</strong>

</summary>
cff-version: 1.2.0
message: 'To cite package "knitr" in publications use:'
type: software
license: GPL-1.0-only
title: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
version: '1.51'
identifiers:
- type: doi
  value: 10.32614/CRAN.package.knitr
abstract: Provides a general-purpose tool for dynamic report generation in R using
  Literate Programming techniques.
authors:
- family-names: Xie
  given-names: Yihui
  email: xie@yihui.name
  orcid: https://orcid.org/0000-0003-0645-5666
preferred-citation:
  type: manual
  title: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
  authors:
  - family-names: Xie
    given-names: Yihui
    orcid: https://orcid.org/0000-0003-0645-5666
    email: xie@yihui.name
  year: '2025'
  notes: R package version 1.51
  url: https://yihui.org/knitr/
repository: https://CRAN.R-project.org/package=knitr
repository-code: https://github.com/yihui/knitr
commit: '1.51'
url: https://yihui.org/knitr/
date-released: '2025-12-20'
contact:
- family-names: Xie
  given-names: Yihui
  email: xie@yihui.name
  orcid: https://orcid.org/0000-0003-0645-5666
keywords:
- dynamic-documents
- knitr
- literate-programming
- r
- r-package
- rmarkdown
- sweave
references:
- type: book
  title: Dynamic Documents with R and knitr
  authors:
  - family-names: Xie
    given-names: Yihui
  publisher:
    name: Chapman and Hall/CRC
    address: Boca Raton, Florida
  year: '2015'
  edition: 2nd
  notes: ISBN 978-1498716963
  url: https://yihui.org/knitr/
- type: generic
  title: 'knitr: A Comprehensive Tool for Reproducible Research in R'
  authors:
  - family-names: Xie
    given-names: Yihui
  collection-title: Implementing Reproducible Computational Research
  collection-type: collection
  editors:
  - family-names: Stodden
    given-names: Victoria
  - family-names: Leisch
    given-names: Friedrich
  - family-names: Peng
    given-names: Roger D.
  publisher:
    name: Chapman and Hall/CRC
  year: '2014'
  notes: ISBN 978-1466561595
- type: software
  title: 'R: A Language and Environment for Statistical Computing'
  notes: Depends
  url: https://www.R-project.org/
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2026'
  version: '>= 3.6.0'
- type: software
  title: evaluate
  abstract: 'evaluate: Parsing and Evaluation Tools that Provide More Details than
    the Default'
  notes: Imports
  url: https://evaluate.r-lib.org/
  repository: https://CRAN.R-project.org/package=evaluate
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: hadley@posit.co
  - family-names: Xie
    given-names: Yihui
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2026'
  doi: 10.32614/CRAN.package.evaluate
  version: '>= 0.15'
- type: software
  title: highr
  abstract: 'highr: Syntax Highlighting for R Source Code'
  notes: Imports
  url: https://github.com/yihui/highr
  repository: https://CRAN.R-project.org/package=highr
  authors:
  - family-names: Xie
    given-names: Yihui
    email: xie@yihui.name
    orcid: https://orcid.org/0000-0003-0645-5666
  - family-names: Qiu
    given-names: Yixuan
  year: '2026'
  doi: 10.32614/CRAN.package.highr
  version: '>= 0.11'
- type: software
  title: methods
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2026'
- type: software
  title: tools
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2026'
- t

Related Skills

View on GitHub
GitHub Stars26
CategoryDevelopment
Updated9h ago
Forks3

Languages

R

Security Score

95/100

Audited on Apr 8, 2026

No findings