Title: | Software Citation Tools |
---|---|
Description: | A collection of functions to extract citation information from 'R' packages and to deal with files in 'citation file format' (<https://citation-file-format.github.io/>), extending the functionality already provided by the citation() function in the 'utils' package. |
Authors: | Jan Philipp Dietrich [aut, cre] (Potsdam Institute for Climate Impact Research, <https://orcid.org/0000-0002-4309-6431>), Waldir Leoncio [aut] (University of Oslo) |
Maintainer: | Jan Philipp Dietrich <[email protected]> |
License: | BSD_2_clause + file LICENSE |
Version: | 0.12.0 |
Built: | 2024-12-16 16:28:12 UTC |
Source: | https://github.com/pik-piam/citation |
A collection of functions to extract citation information from 'R' packages and to deal with files in 'citation file format' (https://citation-file-format.github.io/), extending the functionality already provided by the citation() function in the 'utils' package.
Maintainer: Jan Philipp Dietrich [email protected] (ORCID) (Potsdam Institute for Climate Impact Research)
Authors:
Waldir Leoncio [email protected] (University of Oslo)
Useful links:
Report bugs at https://github.com/pik-piam/citation/issues
Converter citation file format to bibentry
cff2bibentry(x)
cff2bibentry(x)
x |
path to citation file or read in citation in citation file format |
Jan Philipp Dietrich
Creates a summary of the CFF content in markdown format. This can be useful for instance to create software reports.
cff2md(x)
cff2md(x)
x |
path to citation file or read in citation in citation file format |
Jan Philipp Dietrich
Converts a CFF file into DESCRIPTION
cff2r(cffFile = "CITATION.cff", export = FALSE, ...)
cff2r(cffFile = "CITATION.cff", export = FALSE, ...)
cffFile |
Path and name of the CFF file |
export |
if 'TRUE', the output is saved as DESCRIPTION (plus an extension to avoid overwriting) |
... |
when |
CFF is a standard format for the citation of software proposed by Stephan Druskat et. al. (see references below). CFF-compliant files are stored in files named CITATION.cff.
CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software.
When export = TRUE
, the user can use the following arguments
to customize the output file:
The name of the exported file
Defaults to FALSE
. If TRUE
, will replace any
homonymous file present on the export path
By default, the file is saved to a temporary directory. One
may provide a different path here. For example, outpath = "."
will
save to the current working directory
A CFF file converted to a DESCRIPTION file.
Waldir Leoncio
Druskat S., Spaaks J.H., Chue Hong N., Haines R., Baker J. (2019). Citation File Format (CFF) (version 1.1.0). DOI: http://doi.org/10.5281/zenodo.1003149
https://www.software.ac.uk/blog/2017-12-12-standard-format-citation-files https://citation-file-format.github.io https://github.com/citation-file-format/citation-file-format/blob/master/README.md https://citation-file-format.github.io/cff-initializer-javascript/
r2cff
## Not run: # Printing converted file onto R session citation_file <- system.file("CFF-CITATION.cff", package = "citation") cff2r(citation_file) # Saving converted file to temporary folder on system tempFolder <- tempdir() cff2r( citation_file, export = TRUE, outname = "converted-desc", overwrite = TRUE, outpath = tempFolder ) # Making sure the file is indeed there cat(readLines(file.path(tempFolder, "converted-desc")), sep="\n") ## End(Not run)
## Not run: # Printing converted file onto R session citation_file <- system.file("CFF-CITATION.cff", package = "citation") cff2r(citation_file) # Saving converted file to temporary folder on system tempFolder <- tempdir() cff2r( citation_file, export = TRUE, outname = "converted-desc", overwrite = TRUE, outpath = tempFolder ) # Making sure the file is indeed there cat(readLines(file.path(tempFolder, "converted-desc")), sep="\n") ## End(Not run)
Converter citation file format to .zenodo.json metadata file for proper metadata input to Zenodo.
cff2zenodo(x)
cff2zenodo(x)
x |
path to citation file or read in citation in citation file format. If a path is provided the .zenodo.json information will be written directly to a .zenodo.json file in the corresponding folder. Otherwise the metadata will be just returned by the function. |
The metadata information that should be provided to Zenodo in JSON format.
Jan Philipp Dietrich
Creates a report in markdown format for a provided list of repositories and or CITATION.cff files.
cffReport(repos, file = NULL, sortBy = "title")
cffReport(repos, file = NULL, sortBy = "title")
repos |
character vector of repository urls or links to CITATION.cff files to be scanned |
file |
character string naming a file the report should be written to. If NULL the report will be directly returned by the function. |
sortBy |
category by which the report should sort its entries |
the report in markdown format
Jan Philipp Dietrich
Extension of the standard citation function which also extracts DOI information from the URL field in the DESCRIPTION file, if available.
citation_doi(package)
citation_doi(package)
package |
a character string with the name of a single package. |
Jan Philipp Dietrich
citation_doi("citation")
citation_doi("citation")
Converts an object of class citation into a .zenodo.json file. This file is an (officially unsupported) method to provide ZENODO with metadata information about the package and will overwrite the information ZENODO would otherwise auto-generate from the repository.
citation2zenodo(cit, folder = NULL)
citation2zenodo(cit, folder = NULL)
cit |
an object of class citation as returned for instance by the function |
folder |
a folder the file should be written to. If NULL the content is instead printed. |
Jan Philipp Dietrich
cit <- citation_doi("citation") citation2zenodo(cit)
cit <- citation_doi("citation") citation2zenodo(cit)
Creates a .zenodo.json for a R package. This file is an (officially unsupported) method to provide ZENODO with metadata information about the package and will overwrite the information ZENODO would otherwise auto-generate from the repository.
package2zenodo(package = ".")
package2zenodo(package = ".")
package |
either the path to the main folder of a package (containing a DESCRIPTION file) or the name of the package. If a path is provided the .zenodo.json file will be directly added to the folder. Otherwise the content of such a file is just returned. |
The metadata information that should be provided to Zenodo in JSON format.
Jan Philipp Dietrich
package2zenodo("citation")
package2zenodo("citation")
Converts an R package DESCRIPTION file to Citation File Format
r2cff(descriptionFile = "DESCRIPTION", export = FALSE)
r2cff(descriptionFile = "DESCRIPTION", export = FALSE)
descriptionFile |
either the path to a DESCIPTION file, the path to a main folder of a package (containing a DESCRIPTION file) or the name of a package. |
export |
if 'TRUE', the output is saved as CITATION.cff in the folder of the DESCRIPTION file. |
CFF is a standard format for the citation of software proposed by Stephan Druskat et. al. (see references below). CFF-compliant files are stored in files named CITATION.cff.
CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software.
The package's DESCRIPTION file converted to CFF
Waldir Leoncio, Jan Philipp Dietrich
Druskat S., Spaaks J.H., Chue Hong N., Haines R., Baker J. (2019). Citation File Format (CFF) (version 1.1.0). DOI: http://doi.org/10.5281/zenodo.1003149
https://www.software.ac.uk/blog/2017-12-12-standard-format-citation-files https://citation-file-format.github.io https://github.com/citation-file-format/citation-file-format/blob/master/README.md https://citation-file-format.github.io/cff-initializer-javascript/
cff2r
r2cff("citation")
r2cff("citation")
Read a citation file format file (https://citation-file-format.github.io/)
read_cff(file)
read_cff(file)
file |
path to the citation file |
Jan Philipp Dietrich
Scan repositories for existing CITATION.cff information
scanRepos(repos)
scanRepos(repos)
repos |
character vector of repository urls or links to CITATION.cff files to be scanned |
A list with CITATION.cff information collected from the provided repositories
Jan Philipp Dietrich
read_cff
scanRepos(c("https://github.com/magpiemodel/magpie", "https://github.com/remindmodel/remind"))
scanRepos(c("https://github.com/magpiemodel/magpie", "https://github.com/remindmodel/remind"))