head.BibEntry: Return the first or last part of a BibEntry object

head.BibEntryR Documentation

Return the first or last part of a BibEntry object

Description

Prints the first or last entries of a BibEntry object (via message) and returns them invisibly (via invisible).

Usage

## S3 method for class 'BibEntry'
head(x, n = 6L, suppress.messages = TRUE, ...)

## S3 method for class 'BibEntry'
tail(x, n = 6L, suppress.messages = TRUE, ...)

Arguments

x

an object of class BibEntry.

n

a single integer. If positive, size for the resulting object: number of elements for a vector (including lists), rows for a matrix or data frame or lines for a function. If negative, all but the n last/first number of elements of x.

suppress.messages

boolean; should the head/tail entries be printed via message?

...

arguments to be passed to or from other methods.

Details

If suppress.messages is FALSE, the head/tail entries are output to the console along with some additional formatting for the ‘bibtype’ and ‘key’, in addition to invisibly returning the entries.

Value

an object of class BibEntry.

Examples

if (requireNamespace("bibtex")) {
    file <- system.file("Bib", "biblatexExamples.bib", package = "RefManageR")
    BibOptions(check.entries = FALSE)
    bib <- ReadBib(file)
    tail(bib, 2, suppress.messages = FALSE)
    bib <- head(bib, 1, suppress.messages = TRUE)
}

ropensci/RefManageR documentation built on Sept. 2, 2023, 9:32 p.m.