R: Write a 'CITATION.cff' file

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 writes 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
    )

### Arguments

`x` | 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*"`).
`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_create()` for details and examples.
`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 `reference` key?
`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.

### Details

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

### Value

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

### See Also

Guide to Citation File Format schema version 1.2.0.

Other core functions: `cff_create()`, `cff_validate()`, `cff()`

### Examples

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

    cff_obj

    # Force clean-up
    file.remove(tmpfile)

[Package cffr version 0.2.1 Index]