Learn R Programming

handlr (version 0.3.1)

cff_reader: Citation File Format (cff) reader

Description

Citation File Format (cff) reader

Usage

cff_reader(x)

Value

an object of class handl; see handl for more

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

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

Run this code
(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

Run the code above in your browser using DataLab