Coder Social home page Coder Social logo

ropensci / cffr Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 3.0 4.16 MB

Generate Citation File Format (cff) Metadata for R Packages

Home Page: https://docs.ropensci.org/cffr/

License: GNU General Public License v3.0

R 91.94% Shell 0.45% TeX 7.61%
r r-package attribution citation-files citation citation-file-format rstats ropensci cran

cffr's Introduction

cffr cffr website

CRAN-status CRAN-results Downloads R-CMD-check codecov r-universe CITATION-cff DOI Project Status: Active - The project has reached a stable, usable state and is being actively developed. GitHub code size in bytes peer-review

cffr provides utilities to generate, coerce, modify and validate CITATION.cff files automatically for R packages, as well as tools and examples for working with .cff more generally.

What is a CITATION.cff file?

Citation File Format (CFF) (Druskat et al. 2021) (v1.2.0) are plain text files with human- and machine-readable citation information for software (and datasets). Code developers can include them in their repositories to let others know how to correctly cite their software.

This format is becoming popular within the software citation ecosystem. Recently GitHub, Zenodo and Zotero have included full support of this citation format (Druskat 2021). GitHub support is of special interest:

GitHub-link

— Nat Friedman (@natfriedman) July 27, 2021

See Enhanced support for citations on GitHub (Smith 2021) for more info.

Related projects

The CodeMeta Project (Jones et al. 2017) creates a concept vocabulary that can be used to standardize the exchange of software metadata across repositories and organizations. One of the many uses of a codemeta.json file (created following the standards defined on The CodeMeta Project) is to provide citation metadata such as title, authors, publication year, and venue (Fenner 2021). The packages codemeta (Boettiger and Salmon 2021a) / codemetar (Boettiger and Salmon 2021b) allows to generate codemeta.json files from R packages metadata.

The cffr package

cffr maximizes the data extraction by using both the DESCRIPTION file and the CITATION file (if present) of your package. Note that cffr works best if your package pass R CMD check/devtools::check().

As per 2024-07-08 there are at least 322 repos on GitHub using cffr. Check them out here.

Installation

Install cffr from CRAN:

install.packages("cffr")

You can install the developing version of cffr with:

remotes::install_github("ropensci/cffr")

Alternatively, you can install cffr using the r-universe:

# Install cffr in R:
install.packages("cffr",
  repos = c("https://ropensci.r-universe.dev", "https://cloud.r-project.org")
)

Example

By default most often from within your package folder you’ll simply run cff_write(), that creates a cff object, write it on a CITATION.cff file and validates it on a single command:

library(cffr)

# For in-development packages
cff_write()
#>
#> CITATION.cff generated
#>
#> cff_validate results-----
#> Congratulations! This .cff file is valid

However, cffr provides also custom print methods and mechanisms that allows you to customize the CITATION.cff and integrate them in your workflows.

This is a basic example which shows you how to create a cff object (see ?cff for more info). In this case, we are creating a cff object from the metadata of the rmarkdown package:

library(cffr)

# Example with an installed package
test <- cff_create("rmarkdown")
CITATION.cff for rmarkdown
cff-version: 1.2.0
message: 'To cite package "rmarkdown" in publications use:'
type: software
license: GPL-3.0-only
title: 'rmarkdown: Dynamic Documents for R'
version: '2.27'
identifiers:
- type: doi
  value: 10.32614/CRAN.package.rmarkdown
abstract: Convert R Markdown documents into a variety of formats.
authors:
- family-names: Allaire
  given-names: JJ
  email: [email protected]
- family-names: Xie
  given-names: Yihui
  email: [email protected]
  orcid: https://orcid.org/0000-0003-0645-5666
- family-names: Dervieux
  given-names: Christophe
  email: [email protected]
  orcid: https://orcid.org/0000-0003-4474-2498
- family-names: McPherson
  given-names: Jonathan
  email: [email protected]
- family-names: Luraschi
  given-names: Javier
- family-names: Ushey
  given-names: Kevin
  email: [email protected]
- family-names: Atkins
  given-names: Aron
  email: [email protected]
- family-names: Wickham
  given-names: Hadley
  email: [email protected]
- family-names: Cheng
  given-names: Joe
  email: [email protected]
- family-names: Chang
  given-names: Winston
  email: [email protected]
- family-names: Iannone
  given-names: Richard
  email: [email protected]
  orcid: https://orcid.org/0000-0003-3925-190X
preferred-citation:
  type: manual
  title: 'rmarkdown: Dynamic Documents for R'
  authors:
  - family-names: Allaire
    given-names: JJ
    email: [email protected]
  - family-names: Xie
    given-names: Yihui
    email: [email protected]
    orcid: https://orcid.org/0000-0003-0645-5666
  - family-names: Dervieux
    given-names: Christophe
    email: [email protected]
    orcid: https://orcid.org/0000-0003-4474-2498
  - family-names: McPherson
    given-names: Jonathan
    email: [email protected]
  - family-names: Luraschi
    given-names: Javier
  - family-names: Ushey
    given-names: Kevin
    email: [email protected]
  - family-names: Atkins
    given-names: Aron
    email: [email protected]
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  - family-names: Cheng
    given-names: Joe
    email: [email protected]
  - family-names: Chang
    given-names: Winston
    email: [email protected]
  - family-names: Iannone
    given-names: Richard
    email: [email protected]
    orcid: https://orcid.org/0000-0003-3925-190X
  year: '2024'
  notes: R package version 2.27
  url: https://github.com/rstudio/rmarkdown
repository: https://CRAN.R-project.org/package=rmarkdown
repository-code: https://github.com/rstudio/rmarkdown
url: https://pkgs.rstudio.com/rmarkdown/
date-released: '2024-05-17'
contact:
- family-names: Xie
  given-names: Yihui
  email: [email protected]
  orcid: https://orcid.org/0000-0003-0645-5666
keywords:
- literate-programming
- markdown
- pandoc
- r
- r-package
- rmarkdown
references:
- type: book
  title: 'R Markdown: The Definitive Guide'
  authors:
  - family-names: Xie
    given-names: Yihui
  - family-names: Allaire
    given-names: J.J.
  - family-names: Grolemund
    given-names: Garrett
  publisher:
    name: Chapman and Hall/CRC
    address: Boca Raton, Florida
  year: '2018'
  isbn: '9781138359338'
  url: https://bookdown.org/yihui/rmarkdown
- type: book
  title: R Markdown Cookbook
  authors:
  - family-names: Xie
    given-names: Yihui
  - family-names: Dervieux
    given-names: Christophe
  - family-names: Riederer
    given-names: Emily
  publisher:
    name: Chapman and Hall/CRC
    address: Boca Raton, Florida
  year: '2020'
  isbn: '9780367563837'
  url: https://bookdown.org/yihui/rmarkdown-cookbook
- type: software
  title: 'R: A Language and Environment for Statistical Computing'
  notes: Depends
  url: https://www.R-project.org/
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2024'
  version: '>= 3.0'
- type: software
  title: bslib
  abstract: 'bslib: Custom ''Bootstrap'' ''Sass'' Themes for ''shiny'' and ''rmarkdown'''
  notes: Imports
  url: https://rstudio.github.io/bslib/
  repository: https://CRAN.R-project.org/package=bslib
  authors:
  - family-names: Sievert
    given-names: Carson
    email: [email protected]
    orcid: https://orcid.org/0000-0002-4958-2844
  - family-names: Cheng
    given-names: Joe
    email: [email protected]
  - family-names: Aden-Buie
    given-names: Garrick
    email: [email protected]
    orcid: https://orcid.org/0000-0002-7111-0077
  year: '2024'
  doi: 10.32614/CRAN.package.bslib
  version: '>= 0.2.5.1'
- type: software
  title: evaluate
  abstract: 'evaluate: Parsing and Evaluation Tools that Provide More Details than
    the Default'
  notes: Imports
  url: https://github.com/r-lib/evaluate
  repository: https://CRAN.R-project.org/package=evaluate
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  - family-names: Xie
    given-names: Yihui
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2024'
  doi: 10.32614/CRAN.package.evaluate
  version: '>= 0.13'
- type: software
  title: fontawesome
  abstract: 'fontawesome: Easily Work with ''Font Awesome'' Icons'
  notes: Imports
  url: https://rstudio.github.io/fontawesome/
  repository: https://CRAN.R-project.org/package=fontawesome
  authors:
  - family-names: Iannone
    given-names: Richard
    email: [email protected]
    orcid: https://orcid.org/0000-0003-3925-190X
  year: '2024'
  doi: 10.32614/CRAN.package.fontawesome
  version: '>= 0.5.0'
- type: software
  title: htmltools
  abstract: 'htmltools: Tools for HTML'
  notes: Imports
  url: https://rstudio.github.io/htmltools/
  repository: https://CRAN.R-project.org/package=htmltools
  authors:
  - family-names: Cheng
    given-names: Joe
    email: [email protected]
  - family-names: Sievert
    given-names: Carson
    email: [email protected]
    orcid: https://orcid.org/0000-0002-4958-2844
  - family-names: Schloerke
    given-names: Barret
    email: [email protected]
    orcid: https://orcid.org/0000-0001-9986-114X
  - family-names: Chang
    given-names: Winston
    email: [email protected]
    orcid: https://orcid.org/0000-0002-1576-2126
  - family-names: Xie
    given-names: Yihui
    email: [email protected]
  - family-names: Allen
    given-names: Jeff
  year: '2024'
  doi: 10.32614/CRAN.package.htmltools
  version: '>= 0.5.1'
- type: software
  title: jquerylib
  abstract: 'jquerylib: Obtain ''jQuery'' as an HTML Dependency Object'
  notes: Imports
  repository: https://CRAN.R-project.org/package=jquerylib
  authors:
  - family-names: Sievert
    given-names: Carson
    email: [email protected]
    orcid: https://orcid.org/0000-0002-4958-2844
  - family-names: Cheng
    given-names: Joe
    email: [email protected]
  year: '2024'
  doi: 10.32614/CRAN.package.jquerylib
- type: software
  title: jsonlite
  abstract: 'jsonlite: A Simple and Robust JSON Parser and Generator for R'
  notes: Imports
  url: https://jeroen.r-universe.dev/jsonlite
  repository: https://CRAN.R-project.org/package=jsonlite
  authors:
  - family-names: Ooms
    given-names: Jeroen
    email: [email protected]
    orcid: https://orcid.org/0000-0002-4035-0289
  year: '2024'
  identifiers:
  - type: url
    value: https://arxiv.org/abs/1403.2805
  doi: 10.32614/CRAN.package.jsonlite
- type: software
  title: knitr
  abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
  notes: Imports
  url: https://yihui.org/knitr/
  repository: https://CRAN.R-project.org/package=knitr
  authors:
  - family-names: Xie
    given-names: Yihui
    email: [email protected]
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2024'
  doi: 10.32614/CRAN.package.knitr
  version: '>= 1.43'
- type: software
  title: methods
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2024'
  doi: 10.32614/CRAN.package.methods
- type: software
  title: tinytex
  abstract: 'tinytex: Helper Functions to Install and Maintain TeX Live, and Compile
    LaTeX Documents'
  notes: Imports
  url: https://github.com/rstudio/tinytex
  repository: https://CRAN.R-project.org/package=tinytex
  authors:
  - family-names: Xie
    given-names: Yihui
    email: [email protected]
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2024'
  doi: 10.32614/CRAN.package.tinytex
  version: '>= 0.31'
- type: software
  title: tools
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2024'
  doi: 10.32614/CRAN.package.tools
- type: software
  title: utils
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2024'
  doi: 10.32614/CRAN.package.utils
- type: software
  title: xfun
  abstract: 'xfun: Supporting Functions for Packages Maintained by ''Yihui Xie'''
  notes: Imports
  url: https://github.com/yihui/xfun
  repository: https://CRAN.R-project.org/package=xfun
  authors:
  - family-names: Xie
    given-names: Yihui
    email: [email protected]
    orcid: https://orcid.org/0000-0003-0645-5666
  year: '2024'
  doi: 10.32614/CRAN.package.xfun
  version: '>= 0.36'
- type: software
  title: yaml
  abstract: 'yaml: Methods to Convert R Data to YAML and Back'
  notes: Imports
  url: https://github.com/vubiostat/r-yaml/
  repository: https://CRAN.R-project.org/package=yaml
  authors:
  - family-names: Garbett
    given-names: Shawn P
  - family-names: Stephens
    given-names: Jeremy
  - family-names: Simonov
    given-names: Kirill
  - family-names: Xie
    given-names: Yihui
  - family-names: Dong
    given-names: Zhuoer
  - family-names: Wickham
    given-names: Hadley
  - family-names: Horner
    given-names: Jeffrey
  - name: reikoch
  - family-names: Beasley
    given-names: Will
  - family-names: O'Connor
    given-names: Brendan
  - family-names: Warnes
    given-names: Gregory R.
  - family-names: Quinn
    given-names: Michael
  - family-names: Kamvar
    given-names: Zhian N.
  - family-names: Gao
    given-names: Charlie
  year: '2024'
  doi: 10.32614/CRAN.package.yaml
  version: '>= 2.1.19'
- type: software
  title: digest
  abstract: 'digest: Create Compact Hash Digests of R Objects'
  notes: Suggests
  url: https://dirk.eddelbuettel.com/code/digest.html
  repository: https://CRAN.R-project.org/package=digest
  authors:
  - family-names: Lucas
    given-names: Dirk Eddelbuettel with contributions by Antoine
    email: [email protected]
  - family-names: Tuszynski
    given-names: Jarek
  - family-names: Bengtsson
    given-names: Henrik
  - family-names: Urbanek
    given-names: Simon
  - family-names: Frasca
    given-names: Mario
  - family-names: Lewis
    given-names: Bryan
  - family-names: Stokely
    given-names: Murray
  - family-names: Muehleisen
    given-names: Hannes
  - family-names: Murdoch
    given-names: Duncan
  - family-names: Hester
    given-names: Jim
  - family-names: Wu
    given-names: Wush
  - family-names: Kou
    given-names: Qiang
  - family-names: Onkelinx
    given-names: Thierry
  - family-names: Lang
    given-names: Michel
  - family-names: Simko
    given-names: Viliam
  - family-names: Hornik
    given-names: Kurt
  - family-names: Neal
    given-names: Radford
  - family-names: Bell
    given-names: Kendon
  - family-names: Queljoe
    given-names: Matthew
    name-particle: de
  - family-names: Suruceanu
    given-names: Ion
  - family-names: Denney
    given-names: Bill
  - family-names: Schumacher
    given-names: Dirk
  - family-names: Chang
    given-names: Winston
  - family-names: Attali
    given-names: Dean
  - family-names: Chirico.
    given-names: Michael
  year: '2024'
  doi: 10.32614/CRAN.package.digest
- type: software
  title: dygraphs
  abstract: 'dygraphs: Interface to ''Dygraphs'' Interactive Time Series Charting
    Library'
  notes: Suggests
  url: https://github.com/rstudio/dygraphs
  repository: https://CRAN.R-project.org/package=dygraphs
  authors:
  - family-names: Vanderkam
    given-names: Dan
    website: http://dygraphs.com/
  - family-names: Allaire
    given-names: JJ
  - family-names: Owen
    given-names: Jonathan
  - family-names: Gromer
    given-names: Daniel
  - family-names: Thieurmel
    given-names: Benoit
  year: '2024'
  doi: 10.32614/CRAN.package.dygraphs
- type: software
  title: fs
  abstract: 'fs: Cross-Platform File System Operations Based on ''libuv'''
  notes: Suggests
  url: https://fs.r-lib.org
  repository: https://CRAN.R-project.org/package=fs
  authors:
  - family-names: Hester
    given-names: Jim
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  - family-names: Csárdi
    given-names: Gábor
    email: [email protected]
  year: '2024'
  doi: 10.32614/CRAN.package.fs
- type: software
  title: rsconnect
  abstract: 'rsconnect: Deploy Docs, Apps, and APIs to ''Posit Connect'', ''shinyapps.io'',
    and ''RPubs'''
  notes: Suggests
  url: https://rstudio.github.io/rsconnect/
  repository: https://CRAN.R-project.org/package=rsconnect
  authors:
  - family-names: Atkins
    given-names: Aron
    email: [email protected]
  - family-names: Allen
    given-names: Toph
  - family-names: Wickham
    given-names: Hadley
  - family-names: McPherson
    given-names: Jonathan
  - family-names: Allaire
    given-names: JJ
  year: '2024'
  doi: 10.32614/CRAN.package.rsconnect
- type: software
  title: downlit
  abstract: 'downlit: Syntax Highlighting and Automatic Linking'
  notes: Suggests
  url: https://downlit.r-lib.org/
  repository: https://CRAN.R-project.org/package=downlit
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  year: '2024'
  doi: 10.32614/CRAN.package.downlit
  version: '>= 0.4.0'
- type: software
  title: katex
  abstract: 'katex: Rendering Math to HTML, ''MathML'', or R-Documentation Format'
  notes: Suggests
  url: https://docs.ropensci.org/katex/
  repository: https://CRAN.R-project.org/package=katex
  authors:
  - family-names: Ooms
    given-names: Jeroen
    email: [email protected]
    orcid: https://orcid.org/0000-0002-4035-0289
  year: '2024'
  doi: 10.32614/CRAN.package.katex
  version: '>= 1.4.0'
- type: software
  title: sass
  abstract: 'sass: Syntactically Awesome Style Sheets (''Sass'')'
  notes: Suggests
  url: https://rstudio.github.io/sass/
  repository: https://CRAN.R-project.org/package=sass
  authors:
  - family-names: Cheng
    given-names: Joe
    email: [email protected]
  - family-names: Mastny
    given-names: Timothy
    email: [email protected]
  - family-names: Iannone
    given-names: Richard
    email: [email protected]
    orcid: https://orcid.org/0000-0003-3925-190X
  - family-names: Schloerke
    given-names: Barret
    email: [email protected]
    orcid: https://orcid.org/0000-0001-9986-114X
  - family-names: Sievert
    given-names: Carson
    email: [email protected]
    orcid: https://orcid.org/0000-0002-4958-2844
  year: '2024'
  doi: 10.32614/CRAN.package.sass
  version: '>= 0.4.0'
- type: software
  title: shiny
  abstract: 'shiny: Web Application Framework for R'
  notes: Suggests
  url: https://shiny.posit.co/
  repository: https://CRAN.R-project.org/package=shiny
  authors:
  - family-names: Chang
    given-names: Winston
    email: [email protected]
    orcid: https://orcid.org/0000-0002-1576-2126
  - family-names: Cheng
    given-names: Joe
    email: [email protected]
  - family-names: Allaire
    given-names: JJ
    email: [email protected]
  - family-names: Sievert
    given-names: Carson
    email: [email protected]
    orcid: https://orcid.org/0000-0002-4958-2844
  - family-names: Schloerke
    given-names: Barret
    email: [email protected]
    orcid: https://orcid.org/0000-0001-9986-114X
  - family-names: Xie
    given-names: Yihui
    email: [email protected]
  - family-names: Allen
    given-names: Jeff
  - family-names: McPherson
    given-names: Jonathan
    email: [email protected]
  - family-names: Dipert
    given-names: Alan
  - family-names: Borges
    given-names: Barbara
  year: '2024'
  doi: 10.32614/CRAN.package.shiny
  version: '>= 1.6.0'
- type: software
  title: testthat
  abstract: 'testthat: Unit Testing for R'
  notes: Suggests
  url: https://testthat.r-lib.org
  repository: https://CRAN.R-project.org/package=testthat
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  year: '2024'
  doi: 10.32614/CRAN.package.testthat
  version: '>= 3.0.3'
- type: software
  title: tibble
  abstract: 'tibble: Simple Data Frames'
  notes: Suggests
  url: https://tibble.tidyverse.org/
  repository: https://CRAN.R-project.org/package=tibble
  authors:
  - family-names: Müller
    given-names: Kirill
    email: [email protected]
    orcid: https://orcid.org/0000-0002-1416-3412
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  year: '2024'
  doi: 10.32614/CRAN.package.tibble
- type: software
  title: vctrs
  abstract: 'vctrs: Vector Helpers'
  notes: Suggests
  url: https://vctrs.r-lib.org/
  repository: https://CRAN.R-project.org/package=vctrs
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  - family-names: Henry
    given-names: Lionel
    email: [email protected]
  - family-names: Vaughan
    given-names: Davis
    email: [email protected]
  year: '2024'
  doi: 10.32614/CRAN.package.vctrs
- type: software
  title: cleanrmd
  abstract: 'cleanrmd: Clean Class-Less ''R Markdown'' HTML Documents'
  notes: Suggests
  url: https://pkg.garrickadenbuie.com/cleanrmd/
  repository: https://CRAN.R-project.org/package=cleanrmd
  authors:
  - family-names: Aden-Buie
    given-names: Garrick
    email: [email protected]
    orcid: https://orcid.org/0000-0002-7111-0077
  year: '2024'
  doi: 10.32614/CRAN.package.cleanrmd
- type: software
  title: withr
  abstract: 'withr: Run Code ''With'' Temporarily Modified Global State'
  notes: Suggests
  url: https://withr.r-lib.org
  repository: https://CRAN.R-project.org/package=withr
  authors:
  - family-names: Hester
    given-names: Jim
  - family-names: Henry
    given-names: Lionel
    email: [email protected]
  - family-names: Müller
    given-names: Kirill
    email: [email protected]
  - family-names: Ushey
    given-names: Kevin
    email: [email protected]
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  - family-names: Chang
    given-names: Winston
  year: '2024'
  doi: 10.32614/CRAN.package.withr
  version: '>= 2.4.2'
- type: software
  title: xml2
  abstract: 'xml2: Parse XML'
  notes: Suggests
  url: https://xml2.r-lib.org/
  repository: https://CRAN.R-project.org/package=xml2
  authors:
  - family-names: Wickham
    given-names: Hadley
    email: [email protected]
  - family-names: Hester
    given-names: Jim
  - family-names: Ooms
    given-names: Jeroen
  year: '2024'
  doi: 10.32614/CRAN.package.xml2

We can validate the result using cff_validate():

cff_validate(test)
#> ══ Validating cff ══════════════════════════════════════════════════════════════
#> ✔ Congratulations! This <cff> is valid

Check the docs and vignette("cffr", package = "cffr") to learn how to work with cff objects.

Keep your CITATION.cff file up-to-date

GitHub Actions

The easiest way for keeping you CITATION.cff file up-to-date is using GitHub Actions. Use cff_gha_update()function to install a GitHub Action that would update your CITATION.cff file on the following events:

  • When you publish a new release of the package on your GitHub repo.
  • Each time that you modify your DESCRIPTION or inst/CITATION files.
  • The action can be run also manually.
cff_gha_update()

#> Installing update-citation-cff.yaml on './.github/workflows'
#> Adding .github to .Rbuildignore

See the example workflow file here.

Git pre-commit hook Experimental

You can also use a git pre-commit hook:

The pre-commit hook is run first, before you even type in a commit message. It’s used to inspect the snapshot that’s about to be committed, to see if you’ve forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code. Exiting non-zero from this hook aborts the commit, although you can bypass it with git commit --no-verify.

A specific pre-commit hook can be installed with cff_git_hook_install(). If you want to use a pre-commit hook, please make sure you have the testthat package installed.

Learn more

Check the following articles to learn more about cffr:

Related packages

  • citation (Dietrich and Leoncio 2022) includes a function r2cff that creates a CITATION.cff file (v1.1.0) using the information of your DESCRIPTION file. It also provide minimal validity checks.
  • handlr (Chamberlain 2022): Tool for converting among citation formats, including *.cff files.
  • codemeta (Boettiger and Salmon 2021a) / codemetar (Boettiger and Salmon 2021b) provides similar solutions for creating codemeta.json file, another format for storing and sharing software metadata.

Citation

Hernangómez, D., (2021). cffr: Generate Citation File Format Metadata for R Packages. Journal of Open Source Software, 6(67), 3900, https://doi.org/10.21105/joss.03900

A BibTeX entry for LaTeX users is:

@article{hernangomez2021,
    title        = {{cffr}: Generate Citation File Format Metadata for {R} Packages},
    author       = {Diego Hernangómez},
    year         = 2021,
    journal      = {Journal of Open Source Software},
    publisher    = {The Open Journal},
    volume       = 6,
    number       = 67,
    pages        = 3900,
    doi          = {10.21105/joss.03900},
    url          = {https://doi.org/10.21105/joss.03900}
}

You can also use the citation provided by GitHub, that is generated from the information of a CITATION.cff created with cffr. See About CITATION files for more info.

References

Boettiger, Carl, and Maëlle Salmon. 2021a. codemeta: A Smaller codemetar Package. https://CRAN.R-project.org/package=codemeta.

———. 2021b. codemetar: Generate ’CodeMeta’ Metadata for R Packages.

Chamberlain, Scott. 2022. handlr: Convert Among Citation Formats.

Dietrich, Jan Philipp, and Waldir Leoncio. 2022. citation: Software Citation Tools.

Druskat, Stephan. 2021. “Making Software Citation Easi(er) - The Citation File Format and Its Integrations.” https://doi.org/10.5281/zenodo.5529914.

Druskat, Stephan, Jurriaan H. Spaaks, Neil Chue Hong, Robert Haines, James Baker, Spencer Bliven, Egon Willighagen, David Pérez-Suárez, and Alexander Konovalov. 2021. “Citation File Format.” https://doi.org/10.5281/zenodo.5171937.

Fenner, Martin. 2021. “We Need Your Feedback: Aligning the CodeMeta Vocabulary for Scientific Software with Schema.org.” https://doi.org/10.5438/a49j-x692.

Jones, Matthew B, Carl Boettiger, Abby Cabunoc Mayes, Arfon Smith, Peter Slaughter, Kyle Niemeyer, Yolanda Gil, et al. 2017. CodeMeta: An Exchange Schema for Software Metadata. KNB Data Repository. https://doi.org/10.5063/SCHEMA/CODEMETA-2.0.

Smith, Arfon. 2021. “Enhanced Support for Citations on GitHub.” https://github.blog/2021-08-19-enhanced-support-citations-github/.

footer

cffr's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cffr's Issues

duplicate nodes in cff file

When cff_create()ing a cff file from a DESCRIPTION file (either locally from an in-development package or from a path (see below)) some node duplicates are created under the preferred-citation node, e.g. keywords, license, contact or abstract.

cffr::cff_create(system.file("DESCRIPTION", package="jsonlite"), dependencies = FALSE)
#> cff-version: 1.2.0
#> message: 'To cite package "jsonlite" in publications use:'
#> type: software
#> license: MIT
#> title: 'jsonlite: A Simple and Robust JSON Parser and Generator for R'
#> version: 1.8.0
#> abstract: A reasonably fast JSON parser and generator, optimized for statistical data
#>   and the web. Offers simple, flexible tools for working with JSON in R, and is particularly
#>   powerful for building pipelines and interacting with a web API. The implementation
#>   is based on the mapping described in the vignette (Ooms, 2014). In addition to converting
#>   JSON data from/to R objects, 'jsonlite' contains functions to stream, validate,
#>   and prettify JSON data. The unit tests included with the package verify that all
#>   edge cases are encoded and decoded consistently for use with dynamic data in systems
#>   and applications.
#> authors:
#> - family-names: Ooms
#>   given-names: Jeroen
#>   email: [email protected]
#>   orcid: https://orcid.org/0000-0002-4035-0289
#> preferred-citation:
#>   type: manual
#>   title: 'jsonlite: A Simple and Robust JSON Parser and Generator for R'
#>   authors:
#>   - family-names: Ooms
#>     given-names: Jeroen
#>     email: [email protected]
#>     orcid: https://orcid.org/0000-0002-4035-0289
#>   version: 1.8.0
#>   abstract: A reasonably fast JSON parser and generator, optimized for statistical
#>     data and the web. Offers simple, flexible tools for working with JSON in R, and
#>     is particularly powerful for building pipelines and interacting with a web API.
#>     The implementation is based on the mapping described in the vignette (Ooms, 2014).
#>     In addition to converting JSON data from/to R objects, 'jsonlite' contains functions
#>     to stream, validate, and prettify JSON data. The unit tests included with the
#>     package verify that all edge cases are encoded and decoded consistently for use
#>     with dynamic data in systems and applications.
#>   repository: https://CRAN.R-project.org/package=jsonlite
#>   repository-code: https://github.com/jeroen/jsonlite
#>   url: https://arxiv.org/abs/1403.2805
#>   date-released: '2022-02-22'
#>   contact:
#>   - family-names: Ooms
#>     given-names: Jeroen
#>     email: [email protected]
#>     orcid: https://orcid.org/0000-0002-4035-0289
#>   keywords:
#>   - json
#>   - parser
#>   - r
#>   - rstats
#>   license: MIT
#>   year: '2022'
#> repository: https://CRAN.R-project.org/package=jsonlite
#> repository-code: https://github.com/jeroen/jsonlite
#> url: https://arxiv.org/abs/1403.2805
#> date-released: '2022-02-22'
#> contact:
#> - family-names: Ooms
#>   given-names: Jeroen
#>   email: [email protected]
#>   orcid: https://orcid.org/0000-0002-4035-0289
#> keywords:
#> - json
#> - parser
#> - r
#> - rstats
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.2.1 (2022-06-23 ucrt)
#>  os       Windows 10 x64 (build 19044)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language en
#>  collate  German_Germany.utf8
#>  ctype    German_Germany.utf8
#>  tz       Europe/Berlin
#>  date     2022-08-10
#>  pandoc   2.18 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  cffr          0.2.2   2022-08-10 [1] Github (ropensci/cffr@b419e44)
#>  cli           3.3.0   2022-04-25 [1] CRAN (R 4.2.0)
#>  desc          1.4.1   2022-03-06 [1] CRAN (R 4.2.0)
#>  digest        0.6.29  2021-12-01 [1] CRAN (R 4.2.0)
#>  evaluate      0.15    2022-02-18 [1] CRAN (R 4.2.0)
#>  fansi         1.0.3   2022-03-24 [1] CRAN (R 4.2.0)
#>  fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.2.0)
#>  fs            1.5.2   2021-12-08 [1] CRAN (R 4.2.0)
#>  glue          1.6.2   2022-02-24 [1] CRAN (R 4.2.0)
#>  highr         0.9     2021-04-16 [1] CRAN (R 4.2.0)
#>  htmltools     0.5.3   2022-07-18 [1] CRAN (R 4.2.1)
#>  jsonlite      1.8.0   2022-02-22 [1] CRAN (R 4.2.0)
#>  knitr         1.39    2022-04-26 [1] CRAN (R 4.2.0)
#>  lifecycle     1.0.1   2021-09-24 [1] CRAN (R 4.2.0)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.0)
#>  pillar        1.8.0   2022-07-18 [1] CRAN (R 4.2.1)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.2.0)
#>  purrr         0.3.4   2020-04-17 [1] CRAN (R 4.2.0)
#>  R.cache       0.16.0  2022-07-21 [1] CRAN (R 4.2.1)
#>  R.methodsS3   1.8.2   2022-06-13 [1] CRAN (R 4.2.0)
#>  R.oo          1.25.0  2022-06-12 [1] CRAN (R 4.2.0)
#>  R.utils       2.12.0  2022-06-28 [1] CRAN (R 4.2.1)
#>  R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.0)
#>  reprex        2.0.1   2021-08-05 [1] CRAN (R 4.2.0)
#>  rlang         1.0.4   2022-07-12 [1] CRAN (R 4.2.1)
#>  rmarkdown     2.14    2022-04-25 [1] CRAN (R 4.2.0)
#>  rprojroot     2.0.3   2022-04-02 [1] CRAN (R 4.2.0)
#>  rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.2.0)
#>  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.0)
#>  stringi       1.7.8   2022-07-11 [1] CRAN (R 4.2.1)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 4.2.0)
#>  styler        1.7.0   2022-03-13 [1] CRAN (R 4.2.0)
#>  tibble        3.1.8   2022-07-22 [1] CRAN (R 4.2.1)
#>  utf8          1.2.2   2021-07-24 [1] CRAN (R 4.2.0)
#>  vctrs         0.4.1   2022-04-13 [1] CRAN (R 4.2.0)
#>  withr         2.5.0   2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun          0.31    2022-05-10 [1] CRAN (R 4.2.0)
#>  yaml          2.3.5   2022-02-21 [1] CRAN (R 4.2.0)
#> 
#>  [1] C:/Users/Daniel.AK-HAMBURG/AppData/Local/R/win-library/4.2
#>  [2] C:/Program Files/R/R-4.2.1/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

additional examples:

This does not happen, when there is a CITATION file in the repo (i.e. it has a proper preferred citation) or when cff_create() is run on a locally installed package.

`cff_create()` run locally, {tidygeocoder} has a CITATION file
> cffr::cff_create(dependencies = FALSE)
cff-version: 1.2.0
message: 'To cite package "tidygeocoder" in publications use:'
type: software
license: MIT
title: 'tidygeocoder: Geocoding Made Easy'
version: 1.0.4.9000
doi: 10.21105/joss.03544
abstract: An intuitive interface for getting data from geocoding services.
authors:
- family-names: Cambon
  given-names: Jesse
  email: jesse.cambon@gmail.com
  orcid: https://orcid.org/0000-0001-6854-1514
- family-names: Hernangómez
  given-names: Diego
  email: diego.hernangomezherrero@gmail.com
  orcid: https://orcid.org/0000-0001-8457-4658
- family-names: Belanger
  given-names: Christopher
  email: christopher.a.belanger@gmail.com
  orcid: https://orcid.org/0000-0003-2070-5721
- family-names: Possenriede
  given-names: Daniel
  email: possenriede+r@gmail.com
  orcid: https://orcid.org/0000-0002-6738-9845
preferred-citation:
  type: article
  title: 'tidygeocoder: An R package for geocoding'
  authors:
  - family-names: Cambon
    given-names: Jesse
    email: jesse.cambon@gmail.com
    orcid: https://orcid.org/0000-0001-6854-1514
  - family-names: Hernangómez
    given-names: Diego
    email: diego.hernangomezherrero@gmail.com
    orcid: https://orcid.org/0000-0001-8457-4658
  - family-names: Belanger
    given-names: Christopher
    email: christopher.a.belanger@gmail.com
    orcid: https://orcid.org/0000-0003-2070-5721
  - family-names: Possenriede
    given-names: Daniel
    email: possenriede+r@gmail.com
    orcid: https://orcid.org/0000-0002-6738-9845
  doi: 10.21105/joss.03544
  url: https://doi.org/10.21105/joss.03544
  journal: Journal of Open Source Software
  publisher:
    name: The Open Journal
  year: '2021'
  volume: '6'
  issue: '65'
  notes: R package version 1.0.4
  start: '3544'
repository: https://CRAN.R-project.org/package=tidygeocoder
repository-code: https://github.com/jessecambon/tidygeocoder
url: https://jessecambon.github.io/tidygeocoder/
contact:
- family-names: Cambon
  given-names: Jesse
  email: jesse.cambon@gmail.com
  orcid: https://orcid.org/0000-0001-6854-1514
keywords:
- geocoding
- r
- rspatial
- rstats
- tidyverse
`cff_create()` an installed package
cffr::cff_create("jsonlite", dependencies = FALSE)
#> cff-version: 1.2.0
#> message: 'To cite package "jsonlite" in publications use:'
#> type: software
#> license: MIT
#> title: 'jsonlite: A Simple and Robust JSON Parser and Generator for R'
#> version: 1.8.0
#> abstract: A reasonably fast JSON parser and generator, optimized for statistical data
#>   and the web. Offers simple, flexible tools for working with JSON in R, and is particularly
#>   powerful for building pipelines and interacting with a web API. The implementation
#>   is based on the mapping described in the vignette (Ooms, 2014). In addition to converting
#>   JSON data from/to R objects, 'jsonlite' contains functions to stream, validate,
#>   and prettify JSON data. The unit tests included with the package verify that all
#>   edge cases are encoded and decoded consistently for use with dynamic data in systems
#>   and applications.
#> authors:
#> - family-names: Ooms
#>   given-names: Jeroen
#>   email: [email protected]
#>   orcid: https://orcid.org/0000-0002-4035-0289
#> preferred-citation:
#>   type: article
#>   title: 'The jsonlite Package: A Practical and Consistent Mapping Between JSON Data
#>     and R Objects'
#>   authors:
#>   - family-names: Ooms
#>     given-names: Jeroen
#>     email: [email protected]
#>     orcid: https://orcid.org/0000-0002-4035-0289
#>   journal: arXiv:1403.2805 [stat.CO]
#>   year: '2014'
#>   url: https://arxiv.org/abs/1403.2805
#> repository: https://CRAN.R-project.org/package=jsonlite
#> repository-code: https://github.com/jeroen/jsonlite
#> url: https://arxiv.org/abs/1403.2805
#> date-released: '2022-02-22'
#> contact:
#> - family-names: Ooms
#>   given-names: Jeroen
#>   email: [email protected]
#>   orcid: https://orcid.org/0000-0002-4035-0289
#> keywords:
#> - json
#> - parser
#> - r
#> - rstats

Have you thought about omiting the preferred citation altogether if there is no CITATION file? I think a preferred citation that effectively just duplicates the info from the main entry doesn't add much value.

Release cffr 0.1.1

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

Is it possible to use cffr offline?

Thanks for cffr! We are using it in r-universe to generate cff files for all the packages.

One build failed because it seemed github had a network issue at the time:

Generate citation.cff
  citation.cff generated
  Adding  citation.cff to .Rbuildignore
  Error in download.file(jsonschema, schema_temp, mode = "wb", quiet = TRUE) : 
    cannot open URL 'https://raw.githubusercontent.com/citation-file-format/citation-file-format/main/schema.json'
  In addition: Warning message:
  In download.file(jsonschema, schema_temp, mode = "wb", quiet = TRUE) :
    cannot open URL 'https://raw.githubusercontent.com/citation-file-format/citation-file-format/main/schema.json': HTTP status was '503 Service Unavailable'

Is it needed to download this file for every build? Maybe we can include a copy of schema.json in the package, such that it can work offline (given that gh_keywords = FALSE of course)? Or am I missing something?

Release cffr 0.4.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Release cffr 0.5.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Release cffr 0.2.0

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Release cffr 0.2.2

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

Where should the cff file go?

When I run devtools::check() on my package with a CFF file, I get this note:

❯ checking package subdirectories ... NOTE
  Found the following CITATION file in a non-standard place:
    CITATION.cff
  Most likely ‘inst/CITATION’ should be used instead.

However, I also see that this package includes CITATION.cff in the root directory. Is there somewhere else it should go to avoid this note but still have the citation info show up in github, etc?

GitHub rendering issues on CITATION.cff where `preferred-citation: type: manual`

GitHub is not rendering CITATION.cff files properly when preferred-citation has type: manual:

See example repo:

...
preferred-citation:
  type: manual
  title: 'cffr: Generate Citation File Format (''cff'') Metadata for R Packages'
  authors:
  - family-names: Hernangómez
    given-names: Diego
  year: '2021'
  doi: 10.5281/zenodo.5509766
  url: https://dieghernan.github.io/cffr/
...

And the version on this repo:

...
preferred-citation:
  type: generic # <<<<< See the difference
  title: 'cffr: Generate Citation File Format (''cff'') Metadata for R Packages'
  authors:
  - family-names: Hernangómez
    given-names: Diego
  year: '2021'
  doi: 10.5281/zenodo.5509766
  url: https://dieghernan.github.io/cffr/
...

Not sure where to open this issue, so I just open it here:

Pinging @sdruskat, @arfon (citation-file-format/citation-file-format#343) and maybe @hainesr

Release cffr 1.0.1

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

Feature request: Populate inst/CITATION file in R Package with content from CITATION.cff

Current workflow

I use the following workflow when building R Packages and deploying them as website using pkgdown R Package and GitHub Pages

  • populate DESCRIPTION file with author details
  • use cff_create() and cff_write() to add DOI and all authors (a gist for my workflow) to CITATION.cff
  • build site with pkgdown and adapt _pkgdown.yml to edit home section (index.html)
  • deploy with GitHub Pages (Example site for durbanplasticwaste data)

Problem statement

I would like to populate the Citing durbanplasticwaste page that opens under the "Citation" entry in the sidebar with content from the CITATION.cff.

I have discovered that the content is drawn from built-in components:

citation: link to package citation information. Uses either inst/CITATION or, if absent, information from the DESCRIPTION. - Reference: https://pkgdown.r-lib.org/reference/build_home.html#sidebar

I know how to establish the inst/CITATION file with usethis::use_citation()

I realise that cff_create() also checks the inst/CITATION file to create the CITATION.cff.

Feature request

A function that:

  • populates inst/CITATION with content from CITATION.cff (incuding all author_roles, doi, url, year)

I assume that would require an argument for cff_create() to only look in the DESCRIPTION file for content to populate CITATION.cff.

Release cffr 0.2.1

Prepare for release:

  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

Release cffr 0.3.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Release cffr 0.4.1

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push

pkgcheck results - main

Checks for cffr (v0.2.1)

git hash: 4300ecfd

  • ✔️ Package is already on CRAN.
  • ✔️ has a 'CITATION' file.
  • ✔️ has a 'codemeta.json' file.
  • ✔️ has a 'contributing' file.
  • ✔️ uses 'roxygen2'.
  • ✔️ 'DESCRIPTION' has a URL field.
  • ✔️ 'DESCRIPTION' has a BugReports field.
  • ✔️ Package has at least one HTML vignette
  • ✔️ All functions have examples.
  • ✔️ Package has continuous integration checks.
  • ✔️ Package coverage is 98.9%.
  • ✔️ R CMD check found no errors.
  • ✔️ R CMD check found no warnings.

Package License: GPL (>= 3)

Interactions with rOpenSci

An issue to track interactions with rOpenSci:

Presubmission inquiry:
ropensci/software-review#462

Submission:
ropensci/software-review#463


Updated 2021-10-13

Feedback by @zambujo

ropensci/software-review#463 (comment)

  • Add to DESCRIPTION as rev

Should

  • community guidelines: CONTRIBUTING.md is hidden under .github/ and should moved to ./CONTRIBUTING.
  • naming: in cff_parse_citation() (R/cff_parse_citation.R), newlist could be renamed as something more meaningful (eg. parse_cit_final or parse_cit_result)
  • naming: in cran_licences.csv (data-raw/cran-to-spdx.R, line 11), the column name porc could be renamed as either perc (in which case should be multiplied by 100) or share
  • other_persons_entity() (R/parse_citation.R) contains commented code and should be dealt with (removed if not important, or accounted for if important)

Would

  • is.url() (R/assertions.R): would it make sense to also include ftp:// (as in desc:::is_url())?
  • is.email() (R/assertions.R): would it make sense to be a bit more restrictive (eg. https://www.r-bloggers.com/2012/07/validating-email-adresses-in-r/)?
  • would there a way to display the DOI in this page as a proper link?
  • I think cff_validate(x = "CITATION.cff", ...) (R/cff_validate.R) would be more natural than cff_validate(x = "./CITATION.cff", ...)
  • I think cff_write(x, ...) (R/cff_write.R) would be more natural than cff_write(x = ".", ...), as x can take different types
  • dev/ appears to contain development scripts: some could be stashed onto a separate git branch (and removed from main) or placed in a Makefile, thereby removing dev/ from the main branch
  • if one would wish to call inst/extdata/cran-to-spdx.csv from other packages or scripts, it would be easiest to place it in data/cran_to_spdx.rda (and document it in R/data.R)

Add function to create CITATION.cff from codemeta.json

I think most people in the R community have been using the codemeta.json approach until now (especially since it was encouraged by rOpenSci).

Now that GitHub has integrated CITATION.cff in their UI, people might want to switch. It would be amazing if the package could include a conversion function.

I can try to work on a PR if you're interested but don't have time to dedicate to this ☺️

CFF files generated for articles causes GitHub server to crash

Hello,

I am not sure if this is a GitHub issue or a cffr issue.

I tried to generate a CFF file using the cff_from_bibtex() method in cffr. I follow the example in the manual as below:

if (requireNamespace("bibtex", quietly = TRUE)) {
  x <- c(
    "@article{vaswani2017attention,
  title={Attention is all you need},
  author={Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N and Kaiser, Lukasz and Polosukhin, Illia},
  journal={Advances in neural information processing systems},
  volume={30},
  year={2017}
}"
  )
}
  
cff_from_bibtex(x)

This generated the following text:

type: article
title: Attention is all you need
authors:
- family-names: Vaswani
  given-names: Ashish
- family-names: Shazeer
  given-names: Noam
- family-names: Parmar
  given-names: Niki
- family-names: Uszkoreit
  given-names: Jakob
- family-names: Jones
  given-names: Llion
- family-names: Gomez
  given-names: Aidan N
- family-names: Kaiser
  given-names: Lukasz
- family-names: Polosukhin
  given-names: Illia
journal: Advances in neural information processing systems
volume: '30'
year: '2017'

I saved it in a CITATION.cff file and pushed it to my GitHub repository. After that, I went to my GitHub repository to view the file and it leads to a server error (status: 500). GitHub is unable to parse this file. When I remove the line type: article from the file, this error goes away. However, now, instead of citing an article, GitHub assumes that this citation is of type software. Could this be a conflict with CFF specification for articles? GitHub's CFF specification wasn't helpful. So, I was hoping this community was familiar with this issue.

Thank you for all your work!

Release cffr 1.0.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('major')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • Finish & publish blog post
  • Add link to blog post in pkgdown news menu
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)
  • Tweet

error message attempting to write CITATION.cff file from BibTeX file

I previously used version 0.2.0 of the cffr package with the following code to create a CITATION.cff file from a BibTeX file:

library(rbibutils)
library(cffr)

# read in the References stored in a JabRef database
bib <- readBib("./inst/references/Data_References.bib")

# create the cff object
jab_adverse_reactions_citation <- cff_create()

# convert the bibentry object to a cff object (for a proper citation)
bib_to_cff <- cff_parse_citation(bib)

# produce the reference keys from the bibentry object
refkeys <- list(references = bib_to_cff)

# Write the package citation as a .cff file
cff_write(jab_adverse_reactions_citation, keys = refkeys)

However, with the current version 1.0.1, the aforementioned workflow is no longer possible. I have attempted to read the documentation and attempt a new strategy to get the same results, but to no avail. Please refer to the error message below:

# read in the References stored in a JabRef database
jab_adverse_reactions_citation <- cff_read("./inst/references/Data_References.bib")

# > class(jab_adverse_reactions_citation)
# [1] "cff_ref_lst" "cff"

# > cff_write(jab_adverse_reactions_citation)
# Error in x[[i]] : recursive indexing failed at level 2

What's the correct method to create a CITATION.cff file from a BibTeX file?

Thank you.

Irucka

Feature request: Add additional roles from utils::person() function to cff_schema_key() value author

Thank you for working on this great package.

In our workflow we establish R data packages as a way to document and share our research data. In the DESCRIPTION file, we commonly use the roles: ctb and fnd in addition to aut and cre. For reference, see: https://r-pkgs.org/description.html#author-who-are-you

Persons with roles for aut and cre are picked up by cff_write() as "author", but persons with roles ctb or fnd are not.

I understand the limitations are the fields available in Citation File Format schema version 1.2.0.

Would it be possible to add a feature that includes ctb or fnd as "authors" in the CITATION.cff?

v0.1.0 Roadmap

Overall

  • Create codemeta.json file.
  • Packages should run on all major platforms (Windows, macOS, Linux).
  • Consider an object_verb() naming scheme.
  • We strongly recommend snake_case.
  • Use message() and warning() to communicate with the user in your functions. Please do not use print() or cat() unless it's for a print.*() or str.*() methods.
  • We recommend the styler package for automating part of the code styling.
  • Add a code of conduct and contribution guidelines, cf this section of the book.

README

  • Use Active repostatus.org badge.

  • From top to bottom

    • The package name

    • Badges for continuous integration and test coverage, the badge for rOpenSci peer-review once it has started (see below), a repostatus.org badge, and any other badges.

    • Short description of goals of package, with descriptive links to all vignettes (rendered).

    • Installation instructions

    • Any additional setup required (authentication tokens, etc)

    • Brief demonstration usage

    • If applicable, how the package compares to other similar packages and/or how it relates to other packages

    • Citation information

Vignettes

  • Vignette 1: Manipulating cff objects
  • Vignette 2: Crosswalk

TODO

  • Custom GH Action for creating CITATION.cff files

Feature request: Add url key to write_citation() function

Goal

I would like to include the URL of the GitHub pages site for the website that is build with pkgdown R package in the inst/CITATION file.

Problem

Adding the key url to cff_create() adds the URL to the CITATION.cff, but the write_citation() function does not use this key for the final inst/CITATION file.

Example

# install.packages("cffr")
library(cffr)

packageVersion("cffr")

# Download a DESCRIPTION file
tmp <- file.path(tempdir(), "DESCRIPTION")

download.file("https://raw.githubusercontent.com/openwashdata/wasteskipsblantyre/main/DESCRIPTION",
              tmp,
              quiet = TRUE
)

# Hard code doi
doi <- "10.5281/zenodo.6470427"

# get the year
year <- format(Sys.time(), "%Y")

# creates CFF with all author roles
mod_cff <- cff_create(tmp, 
                      dependencies = FALSE,
                      keys = list("doi" = doi,
                                  "url" = "https://openwashdata.github.io/wasteskipsblantyre/",
                                  "date-released" = Sys.Date()))

# writes the CFF file
cff_write(mod_cff)

# Now write a CITATION file from the CITATION.cff file
# Use inst/CITATION instead (the default if not provided)
path_cit <- file.path("inst/CITATION")

write_citation("CITATION.cff", file = path_cit)

# By last, read the citation
cat(readLines(path_cit), sep = "\n")

# Start of inst/CITATION
utils::readCitationFile("inst/CITATION")

Release cffr 0.1.0

First release:

Prepare for release:

  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.