| cff {cffr} | R Documentation |
cff objectsA class and utility methods for reading, creating and holding CFF information.
cff(path, ...) as.cff(x)
path |
The path to a |
... |
Named arguments to be used for creating a |
x |
a character string for the |
This object can be manipulated using cff_create().
Note that this function reads CITATION.cff files. If you want to
create cff objects from DESCRIPTION files use cff_create().
If no additional ... parameters are supplied (the default behavior),
a minimal valid cff object is created. Valid parameters are those
specified on cff_schema_keys():
| valid cff keys |
| cff-version |
| message |
| type |
| license |
| title |
| version |
| doi |
| abstract |
| authors |
| preferred-citation |
| repository |
| repository-artifact |
| repository-code |
| url |
| date-released |
| contact |
| keywords |
| references |
| commit |
| identifiers |
| license-url |
A cff object. Under the hood, a cff object is a regular list
object with a special print() method.
Other core functions:
cff_create(),
cff_validate(),
cff_write()
# Blank cff
cff()
# From file
cff(system.file("examples/CITATION_basic.cff",
package = "cffr"
))
# Use custom params
test <- cff(
title = "Manipulating files",
keywords = c("A", "new", "list", "of", "keywords"),
authors = list(cff_parse_person("New author"))
)
test
# Would fail
cff_validate(test)
# Modify with cff_create
new <- cff_create(test, keys = list(
"cff-version" = "1.2.0",
message = "A blank file"
))
new
# Would pass
cff_validate(new)
# Convert a list to "cff" object
cffobj <- as.cff(list(
"cff-version" = "1.2.0",
title = "Manipulating files"
))
class(cffobj)
# Nice display thanks to yaml package
cffobj