CITATION.cff filecff_write() is the primary workflow for package development.
This function writes a CITATION.cff file for a given package. It wraps
cff_create() to create the cff object, then writes it to a
YAML-formatted file in one command.
cff_write(
x,
outfile = "CITATION.cff",
keys = list(),
cff_version = "1.2.0",
gh_keywords = TRUE,
r_citation = FALSE,
dependencies = TRUE,
validate = TRUE,
verbose = TRUE,
authors_roles = c("aut", "cre"),
encoding = "UTF-8"
)Invisibly returns the generated cff object. This function is called
primarily for its side effect of writing a CITATION.cff file.
The source used to generate the cff object. It can be:
A missing value, which retrieves the DESCRIPTION file from your
in-development R package.
An existing cff object.
The name of an installed package ("jsonlite").
A path to a DESCRIPTION file ("./DESCRIPTION").
The name and path of the CITATION.cff to be created.
Relative paths are resolved from the current working directory,
independently of the source specified in x.
A list of additional keys to add to the cff object. See
cff_modify().
The Citation File Format schema version used for the generated metadata.
A logical value. If TRUE and the package is hosted on
GitHub, add the repository topics as keywords.
A logical value. If TRUE, the R package
citation (inst/CITATION) is created or updated relative to the current
working directory. No backup copy is created. For more control, use
cff_write_citation().
A logical value. If TRUE, add the package dependencies
to the references CFF key.
A logical value. If TRUE, validate the new file with
cff_validate().
A logical value. If TRUE, the function displays
informative messages.
Roles to be considered as authors of the package when
generating the CITATION.cff file. See Details.
The name of the encoding to be assumed. Default is "UTF-8",
but it can be any other value accepted by base::iconv(), such as
"ASCII//TRANSLIT".
For details of authors_roles, see cff_create().
The x argument identifies the metadata source. It does not determine the
output directory. This allows you to create a CITATION.cff from a package
or file located outside the current working directory.
When creating and writing a CITATION.cff for a package in the current
working directory, this function adds the pattern "^CITATION\.cff$" to
the local .Rbuildignore file.
Citation File Format schema guide.
Core cffr workflow:
cff(),
cff_create(),
cff_modify(),
cff_validate()
Write citation metadata files:
cff_write_bib()
# \donttest{
tmpfile <- tempfile(fileext = ".cff")
cff_obj <- cff_write("jsonlite", outfile = tmpfile)
cff_obj
# Force cleanup.
file.remove(tmpfile)
# }
Run the code above in your browser using DataLab