cff {cffr}R Documentation

cff objects

Description

A class and utility methods for reading, creating and holding CFF information.

Usage

cff(path, ...)

as.cff(x)

Arguments

path

The path to a CITATION.cff file.

...

Named arguments to be used for creating a cff object. See Details.

x

a character string for the as.cff default method

Details

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

Value

A cff object. Under the hood, a cff object is a regular list object with a special print() method.

See Also

Other core functions: cff_create(), cff_validate(), cff_write()

Examples


# 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

[Package cffr version 0.2.0 Index]