This is the core function of the package and likely to be the only one you would need when developing a package.

This function writes out a CITATION.cff file for a given package. This function is basically a wrapper around cff_create() to both create the cff object and writes it out to a YAML-formatted file in one command.

  outfile = "CITATION.cff",
  keys = list(),
  cff_version = "1.2.0",
  gh_keywords = TRUE,
  validate = TRUE,
  verbose = TRUE



The source that would be used for generating the CITATION.cff file. It could be:

  • A missing value. That would retrieve the DESCRIPTION file on your in-development package.

  • A cff object,

  • The name of an installed package ("jsonlite"), or

  • Path to a DESCRIPTION file ("*/DESCRIPTION*").


The name and path of the CITATION.cff to be created.


List of additional keys to add to the cff object. See cff_create() for details and examples.


The Citation File Format schema version that the CITATION.cff file adheres to for providing the citation metadata.


Logical TRUE/FALSE. If the package is hosted on GitHub, would you like to add the repo topics as keywords?


Logical TRUE/FALSE. Should the new file be validated using cff_validate()?


Logical TRUE/FALSE. On TRUE the function would display informative messages.


A CITATION.cff file and an (invisible) cff object.


When creating and writing a CITATION.cff for the first time, the function adds "CITATION.cff" to ".Rbuildignore".


# \donttest{
tmpfile <- tempfile(fileext = ".cff")
cff_obj <- cff_write("jsonlite", outfile = tmpfile)
#> /tmp/RtmpBZ9PW3/file2ae2e4199a9.cff generated
#> cff_validate results-----
#> Congratulations! This .cff file is valid

#> cff-version: 1.2.0
#> message: 'To cite package "jsonlite" in publications use:'
#> type: software
#> license: MIT
#> title: 'jsonlite: A Simple and Robust JSON Parser and Generator for R'
#> version: 1.7.2
#> abstract: A reasonably fast JSON parser and generator, optimized for statistical data
#>   and the web. Offers simple, flexible tools for working with JSON in R, and is particularly
#>   powerful for building pipelines and interacting with a web API. The implementation
#>   is based on the mapping described in the vignette (Ooms, 2014). In addition to converting
#>   JSON data from/to R objects, 'jsonlite' contains functions to stream, validate,
#>   and prettify JSON data. The unit tests included with the package verify that all
#>   edge cases are encoded and decoded consistently for use with dynamic data in systems
#>   and applications.
#> authors:
#> - family-names: Ooms
#>   given-names: Jeroen
#>   email: [email protected]
#>   orcid:
#> preferred-citation:
#>   type: article
#>   title: 'The jsonlite Package: A Practical and Consistent Mapping Between JSON Data
#>     and R Objects'
#>   authors:
#>   - family-names: Ooms
#>     given-names: Jeroen
#>   journal: arXiv:1403.2805 [stat.CO]
#>   year: '2014'
#>   url:
#> repository:
#> repository-code:
#> url:
#> date-released: '2020-12-09'
#> contact:
#> - family-names: Ooms
#>   given-names: Jeroen
#>   email: [email protected]
#>   orcid:

# Force clean-up
#> [1] TRUE
# }