Skip to contents

Add new keys or modify existing ones on a cff object.

Usage

cff_modify(x, ...)

Arguments

x

A cff object.

...

Named arguments to be used for modifying x. See also ... argument in cff().

Value

A cff object.

Details

Keys provided in ... would override the corresponding key in x.

It is possible to add additional keys not detected by cff_create() using the keys argument. A list of valid keys can be retrieved with cff_schema_keys(). Please refer to Guide to Citation File Format schema version 1.2.0. for additional details.

See also

This function is wrapper of utils::modifyList().

See cff() for creating cff objects from scratch.

Other core functions of cffr: cff(), cff_create(), cff_validate()

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 ══════════════════════════════════════════════════════════════
#>  Congratulations! This <cff> is valid


x_mod <- cff_modify(x,
  contact = as_cff_person("A contact"),
  message = "This overwrites fields",
  title = "New Title",
  abstract = "New abstract",
  doi = "10.21105/joss.03900"
)

x_mod
#> cff-version: 1.2.0
#> message: This overwrites fields
#> 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 ══════════════════════════════════════════════════════════════
#>  Congratulations! This <cff> is valid