Package 'citation'

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.11.3
Built: 2024-08-26 05:18:47 UTC
Source: https://github.com/pik-piam/citation

Help Index


citation: 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.

Author(s)

Maintainer: Jan Philipp Dietrich [email protected] (ORCID) (Potsdam Institute for Climate Impact Research)

Authors:

See Also

Useful links:


cff2bibentry

Description

Converter citation file format to bibentry

Usage

cff2bibentry(x)

Arguments

x

path to citation file or read in citation in citation file format

Author(s)

Jan Philipp Dietrich


cff2md

Description

Creates a summary of the CFF content in markdown format. This can be useful for instance to create software reports.

Usage

cff2md(x)

Arguments

x

path to citation file or read in citation in citation file format

Author(s)

Jan Philipp Dietrich


Convert from CFF into R

Description

Converts a CFF file into DESCRIPTION

Usage

cff2r(cffFile = "CITATION.cff", export = FALSE, ...)

Arguments

cffFile

Path and name of the CFF file

export

if 'TRUE', the output is saved as DESCRIPTION (plus an extension to avoid overwriting)

...

when export = TRUE, the user can pass additional arguments to the exportDESCRIPTION function. More information in the Details section.

Details

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:

outname

The name of the exported file

overwrite

Defaults to FALSE. If TRUE, will replace any homonymous file present on the export path

outpath

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

Value

A CFF file converted to a DESCRIPTION file.

Author(s)

Waldir Leoncio

References

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/

See Also

r2cff

Examples

## 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)

cff2zenodo

Description

Converter citation file format to .zenodo.json metadata file for proper metadata input to Zenodo.

Usage

cff2zenodo(x)

Arguments

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.

Value

The metadata information that should be provided to Zenodo in JSON format.

Author(s)

Jan Philipp Dietrich


cffReport

Description

Creates a report in markdown format for a provided list of repositories and or CITATION.cff files.

Usage

cffReport(repos, file = NULL, sortBy = "title")

Arguments

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

Value

the report in markdown format

Author(s)

Jan Philipp Dietrich


citation_doi

Description

Extension of the standard citation function which also extracts DOI information from the URL field in the DESCRIPTION file, if available.

Usage

citation_doi(package)

Arguments

package

a character string with the name of a single package.

Author(s)

Jan Philipp Dietrich

Examples

citation_doi("citation")

citation2zenodo

Description

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.

Usage

citation2zenodo(cit, folder = NULL)

Arguments

cit

an object of class citation as returned for instance by the function citation, or the name of a R package to be used as source.

folder

a folder the file should be written to. If NULL the content is instead printed.

Author(s)

Jan Philipp Dietrich

Examples

cit <- citation_doi("citation")
citation2zenodo(cit)

package2zenodo

Description

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.

Usage

package2zenodo(package = ".")

Arguments

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.

Value

The metadata information that should be provided to Zenodo in JSON format.

Author(s)

Jan Philipp Dietrich

Examples

package2zenodo("citation")

Convert from R DESCRIPTION into CFF

Description

Converts an R package DESCRIPTION file to Citation File Format

Usage

r2cff(descriptionFile = "DESCRIPTION", export = FALSE)

Arguments

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.

Details

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.

Value

The package's DESCRIPTION file converted to CFF

Author(s)

Waldir Leoncio, Jan Philipp Dietrich

References

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/

See Also

cff2r

Examples

r2cff("citation")

read_cff

Description

Read a citation file format file (https://citation-file-format.github.io/)

Usage

read_cff(file)

Arguments

file

path to the citation file

Author(s)

Jan Philipp Dietrich


scan repositories

Description

Scan repositories for existing CITATION.cff information

Usage

scanRepos(repos)

Arguments

repos

character vector of repository urls or links to CITATION.cff files to be scanned

Value

A list with CITATION.cff information collected from the provided repositories

Author(s)

Jan Philipp Dietrich

See Also

read_cff

Examples

scanRepos(c("https://github.com/magpiemodel/magpie",
            "https://github.com/remindmodel/remind"))