Add new keys to a cff object or modify existing ones.
Value
A cff object.
Details
Keys provided in ... override the corresponding key in x.
You can add additional keys not detected by cff_create() using
the keys argument. A list of valid keys can be retrieved with
cff_schema_keys(). See the following guide for additional details:
Citation File Format schema guide.
See also
This function is a wrapper of utils::modifyList().
Core cffr workflow:
cff(),
cff_create(),
cff_validate(),
cff_write()
Examples
x <- cff()
x
#> cff-version: 1.2.0
#> message: If you use this software, please cite it using these metadata.
#> title: My Research Software
#> authors:
#> - family-names: Doe
#> given-names: John
cff_validate(x)
#> ══ Validating CFF ══════════════════════════════════════════════════════════════
#> ✔ This <cff> object is valid.
x_mod <- cff_modify(x,
contact = as_cff_person("A contact"),
message = "This overwrites keys",
title = "New Title",
abstract = "New abstract",
doi = "10.21105/joss.03900"
)
x_mod
#> cff-version: 1.2.0
#> message: This overwrites keys
#> title: New Title
#> authors:
#> - family-names: Doe
#> given-names: John
#> contact:
#> - family-names: contact
#> given-names: A
#> abstract: New abstract
#> doi: 10.21105/joss.03900
cff_validate(x_mod)
#> ══ Validating CFF ══════════════════════════════════════════════════════════════
#> ✔ This <cff> object is valid.
