bib <- bibentry("Misc",
title = "My title",
author = "Fran Pérez"
)
my_temp_bib <- tempfile(fileext = ".bib")
cff_write_bib(bib, file = my_temp_bib)
cat(readLines(my_temp_bib), sep = "\n")
cff_write_bib(bib, file = my_temp_bib, ascii = TRUE, append = TRUE)
cat(readLines(my_temp_bib), sep = "\n")
# Create a CITATION file
# Use a system file
f <- system.file("examples/preferred-citation-book.cff", package = "cffr")
a_cff <- cff_read(f)
out <- file.path(tempdir(), "CITATION")
cff_write_citation(a_cff, file = out)
# Check by reading, use meta object
meta <- packageDescription("cffr")
meta$Encoding <- "UTF-8"
utils::readCitationFile(out, meta)
Run the code above in your browser using DataLab