| cff_create {cffr} | R Documentation |
cff objectCreate a cff object from a given source for further manipulation.
Similar to cff_write(), but returns a object rather than writing
directly to a file. See Examples.
cff_create( x, keys = list(), cff_version = "1.2.0", gh_keywords = TRUE, dependencies = TRUE )
x |
The source that would be used for generating
the
|
keys |
List of additional keys to add to the |
cff_version |
The Citation File Format schema version that the
|
gh_keywords |
Logical |
dependencies |
Logical |
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.
If x is a path to a DESCRIPTION file or inst/CITATION, is not present on
your package, cffr would auto-generate a preferred-citation key using
the information provided on that file. On
A cff list object.
Guide to Citation File Format schema version 1.2.0.
vignette("cffr", "cffr")
Other core functions:
cff_validate(),
cff_write(),
cff()
# Installed package
cff_create("jsonlite")
# Demo file
demo_file <- system.file("examples/DESCRIPTION_basic", package = "cffr")
cff_create(demo_file)
# Add additional keys
newkeys <- list(
message = "This overwrites fields",
abstract = "New abstract",
keywords = c("A", "new", "list", "of", "keywords"),
authors = list(cff_parse_person("New author"))
)
cff_create(demo_file, keys = newkeys)
# Update a field on a list - i,e: authors, contacts, etc.
# We are adding a new contact here
old <- cff_create(demo_file)
new_contact <- append(
old$contact,
list(
cff_parse_person(person(
given = "I am",
family = "New Contact"
))
)
)
cff_create(demo_file, keys = list("contact" = new_contact))