| cff_read | R Documentation |
cff objectRead files and convert them to cff objects. Supported files are:
CITATION.cff files.
DESCRIPTION files.
R citation files (usually located in inst/CITATION).
BibTeX files (with extension *.bib).
cff_read() attempts to guess the type of file provided in path. However,
we provide aliases for each specific file type:
cff_read_cff_citation(), which uses yaml::read_yaml().
cff_read_description(), which uses desc::desc().
cff_read_citation(), which uses utils::readCitationFile().
cff_read_bib(), which requires bibtex (>= 0.5.0) and uses
bibtex::read.bib().
cff_read(path, ...)
cff_read_cff_citation(path, ...)
cff_read_description(
path,
cff_version = "1.2.0",
gh_keywords = TRUE,
authors_roles = c("aut", "cre"),
...
)
cff_read_citation(path, meta = NULL, ...)
cff_read_bib(path, encoding = "UTF-8", ...)
path |
A path to a file. |
... |
Arguments passed to other functions, for example to
|
cff_version |
The Citation File Format schema version used for the generated metadata. |
gh_keywords |
A logical value. If |
authors_roles |
Roles to be considered as authors of the package when
generating the |
meta |
A list of package metadata as obtained by
|
encoding |
Encoding to be assumed for |
For details of cff_read_description(), see cff_create().
meta objectSection 1.9 CITATION files of Writing R Extensions (R Core Team 2026)
specifies how to create dynamic CITATION files using a meta object.
Therefore, the meta argument in cff_read_citation() may be needed to
read some files correctly.
cff_read_cff_citation() and cff_read_description() return an object
with class cff.
cff_read_citation() and cff_read_bib() return an object of classes
cff_ref_lst, cff as defined by the
definitions.reference specified in the following guide:
Citation File Format schema guide.
Learn more about the cffr class system in cff_class.
R Core Team (2026). Writing R Extensions. https://cran.r-project.org/doc/manuals/r-release/R-exts.html.
Hernangómez D (2022). "BibTeX and CFF, a potential crosswalk." cffr vignette. https://docs.ropensci.org/cffr/articles/bibtex-cff.html.
The underlying functions used for reading external files:
yaml::read_yaml() for CITATION.cff files.
desc::desc() for DESCRIPTION files.
utils::readCitationFile() for R citation files.
bibtex::read.bib() for BibTeX files (extension *.bib).
Read external citation metadata:
cff_read_bib_text()
Work with BibTeX metadata:
as_bibentry(),
cff_read_bib_text(),
cff_write_bib(),
encoded_utf_to_latex()
# Create a `cff` object from a `CITATION.cff` file.
from_cff_file <- cff_read(system.file("examples/CITATION_basic.cff",
package = "cffr"
))
head(from_cff_file, 7)
# Create a `cff` object from DESCRIPTION.
from_desc <- cff_read(system.file("examples/DESCRIPTION_basic",
package = "cffr"
))
from_desc
# Create a `cff` object from BibTeX.
if (requireNamespace("bibtex", quietly = TRUE)) {
from_bib <- cff_read(system.file("examples/example.bib",
package = "cffr"
))
# First item only.
from_bib[[1]]
}
# Create a `cff` object from CITATION.
from_citation <- cff_read(system.file("CITATION", package = "cffr"))
# First item only.
from_citation[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.