cff_reader: Citation File Format (cff) reader

View source: R/cff_reader.R

cff_readerR Documentation

Citation File Format (cff) reader

Description

Citation File Format (cff) reader

Usage

cff_reader(x)

Arguments

x

(character) a file path or a yaml string

Details

CFF only supports one citation, so many will always be FALSE.

Required fields:

  • CFF v1.1.0: cff-version, version, message, date-released, title, authors.

  • CFF v1.2.0: cff-version, message, title, authors.

We'll stop with error if any of these are missing.

You can though have many references in your CFF file associated with the citation. references is an optional component in cff files. If included, we check the following:

  • each reference must have the 3 required fields: type, authors, title

  • type must be in the allowed set, see cff_reference_types

  • the elements within authors must each be an entity or person object https://github.com/citation-file-format/citation-file-format#entity-objects https://github.com/citation-file-format/citation-file-format#person-objects

  • title must be a string

Value

an object of class handl; see handl for more

References

CFF format: https://github.com/citation-file-format/citation-file-format

See Also

Other readers: bibtex_reader(), citeproc_reader(), codemeta_reader(), ris_reader()

Other cff: cff_writer()

Examples

(z <- system.file("extdata/citation.cff", package = "handlr"))
res <- cff_reader(x = z)
res
res$cff_version
res$software_version
res$message
res$id
res$doi
res$title
res$author
res$references

# no references
(z <- system.file("extdata/citation-norefs.cff", package = "handlr"))
out <- cff_reader(x = z)
out
out$references

ropensci/handlr documentation built on April 26, 2022, 7:37 a.m.