| cff_create | R Documentation |
cff object from several sourcesCreate a full and possibly valid cff object from a given source. This
object can be written to a *.cff file with cff_write(),
see Examples.
Most of the heavy lifting of cffr is done via this function.
cff_create(
x,
keys = list(),
cff_version = "1.2.0",
gh_keywords = TRUE,
dependencies = TRUE,
authors_roles = c("aut", "cre")
)
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 |
authors_roles |
Roles to be considered as authors of the package when
generating the |
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.
By default, only persons whose role in the DESCRIPTION file of the package
is author ("aut") or maintainer ("cre") are considered to be authors
of the package. The default setting can be controlled via the authors_roles
parameter. See Details on person() to get additional insights
on person roles.
A cff object.
Guide to Citation File Format schema version 1.2.0.
cff_modify() as the recommended way to modify a cff object.
cff_write() for creating a CFF file.
vignette("cffr", "cffr") shows an introduction on how manipulate
cff objects.
vignette("crosswalk", package = "cffr") provides details on how the
metadata of a package is mapped to produce a cff object.
Other core functions of cffr:
cff(),
cff_modify(),
cff_validate()
# 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 = as_cff_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,
as_cff_person(person(
given = "I am",
family = "New Contact"
))
)
cff_create(demo_file, keys = list("contact" = new_contact))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.