Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

citation: Citing R and R Packages in Publications

citationR Documentation

Citing R and R Packages in Publications

Description

How to citeR andR packages in publications.

Usage

citation(package = "base", lib.loc = NULL, auto = NULL)readCitationFile(file, meta = NULL)

Arguments

package

a character string with the name of a single package.An error occurs if more than one package name is given.

lib.loc

a character vector with path names ofR libraries, orthe directory containing the source forpackage, orNULL. The default value ofNULL corresponds to alllibraries currently known. If the default is used, the loadedpackages are searched before the libraries.

auto

a logical indicating whether the default citationauto-generated from the package ‘DESCRIPTION’ metadata shouldbe used or not, orNULL (default), indicating that a‘CITATION’ file is used if it exists, or an object of class"packageDescription" with package metadata (seebelow).

file

a file name.

meta

a list of package metadata as obtained bypackageDescription, orNULL (the default).

Details

TheR core development team and the very active community of packageauthors have invested a lot of time and effort in creatingR as it istoday. Please give credit where credit is due and citeR andRpackages when you use them for data analysis.

Execute functioncitation() for information on how to cite thebase R system in publications. If the name of a non-base package isgiven, the function either returns the information contained in the‘CITATION’ file of the package (usingreadCitationFilewithmeta equal topackageDescription(package, lib.loc))or auto-generates citation information from the ‘DESCRIPTION’file.

InR >= 2.14.0, one can use aAuthors@R field in‘DESCRIPTION’ to provide (R code giving) aperson object with a refined, machine-readabledescription of the package “authors” (in particular specifyingtheir precise roles). Only those with an author role will beincluded in the auto-generated citation.

If only one reference is given, the print method for the objectreturned bycitation() shows both a text version and a BibTeXentry for it, if a package has more than one reference then only thetext versions are shown. The BibTeX versions can be obtained usingfunctiontoBibtex() (see the examples below).

The ‘CITATION’ file of an R package should be placed in the‘inst’ subdirectory of the package source. The file is an Rsource file and may contain arbitrary R commands includingconditionals and computations. FunctionreadCitationFile() isused bycitation() to extract the information in‘CITATION’ files. The file issource()ed by the Rparser in a temporary environment and all resulting bibliographicobjects (specifically, of class"bibentry") arecollected.

Traditionally, the ‘CITATION’ file contained zero or more callstocitHeader, then one or more calls tocitEntry,and finally zero or more calls tocitFooter, where in factcitHeader andcitFooter are simply wrappers topaste, with their... argument passed on topaste as is. The"bibentry" classmakes for improved representation and manipulation of bibliographicinformation (in fact, the old mechanism is implemented using the newone), and one can write ‘CITATION’ files using the unifiedbibentry interface.

One can include an auto-generated package citation in the‘CITATION’ file viacitation(auto = meta).

readCitationFile makes use of theEncoding element (ifany) ofmeta to determine the encoding of the file.

Value

An object of class"citation", inheriting from class"bibentry"; see there, notably for theprint andformat methods.

See Also

bibentry

Examples

## the basic R referencecitation()## references for a package -- might not have these installedif(nchar(system.file(package = "lattice"))) citation("lattice")if(nchar(system.file(package = "foreign"))) citation("foreign")## extract the bibtex entry from the return valuex <- citation()toBibtex(x)## A citation with more than one bibentry:cm <- tryCatch(citation("mgcv"),               error = function(e) {                 warning("Recommended package 'mgcv' is not installed properly")                 stop(e$message) })cm # short entries (2-3 lines each)print(cm, bibtex = TRUE) # each showing its bibtex code

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2025 Movatter.jp