cff_write {cffr}R Documentation

Write a CITATION.cff file

Description

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 write it out to a YAML-formatted file in one command.

Usage

cff_write(
  x,
  outfile = "CITATION.cff",
  keys = list(),
  cff_version = "1.2.0",
  gh_keywords = TRUE,
  dependencies = TRUE,
  validate = TRUE,
  verbose = TRUE,
  authors_roles = c("aut", "cre"),
  encoding = "UTF-8"
)

Arguments

x

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

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

  • An existing cff object.

  • The name of an installed package ("jsonlite").

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

outfile

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

keys

List of additional keys to add to the cff object. See cff_modify().

cff_version

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

gh_keywords

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

dependencies

Logical TRUE/FALSE. Would you like to add the of your package to the references CFF key?

validate

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

verbose

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

authors_roles

Roles to be considered as authors of the package when generating the CITATION.cff file. See Details.

encoding

The name of the encoding to be assumed. Default is "UTF-8", but it can be any other value as accepted by iconv(), such as "ASCII//TRANSLIT".

Details

For details of authors_roles see cff_create().

When creating and writing a CITATION.cff for the first time, the function adds the pattern "^CITATION\.cff$" to your .Rbuildignore file to avoid NOTEs and WARNINGs in ⁠R CMD CHECK⁠.

Value

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

See Also

Guide to Citation File Format schema version 1.2.0. This function unifies the workflow cff_create() + cff_validate() + write a file.

Other functions for creating external files: cff_write_bib()

Examples


tmpfile <- tempfile(fileext = ".cff")
cff_obj <- cff_write("jsonlite", outfile = tmpfile)

cff_obj

# Force clean-up
file.remove(tmpfile)


[Package cffr version 1.0.1 Index]