Get all references from a Bibtex file.
arguments to be passed on to the file getting functions, character strings, see ‘Details’.
name of a package, a character string or NULL.
name of a Bibtex file, a character string.
if TRUE, restrict percent escaping to BibTeX field
get_bibentries parses the specified file using
from package bibtex \insertCiteRpack:bibtexRdpack and sets its
names attribute to the keys of the bib elements
read.bib() does this since version version 0.4.0 of
bibtex, as well). Here is what
get_bibentries does on top of
read.bib (the details are
get_bibentries deals with percent signs in URL's.
if the current working directory is in the development
get_bibentries will first
search for the bib file under that directory.
bibfile should normally be the base name of the Bibtex file.
get_bibentries without any
results in looking for the Bibtex file in the current directory if
package is NULL or missing, and in the installation directory of the
specified package, otherwise.
Argument "..." may be used to specify directories.
package is missing or NULL, the complete path is obtained
file.path(..., bibfile). Otherwise
package must be
a package name and the file is taken from the installation directory
of the package. Again, argument "..." can specify subdirectory
If the current working directory is in the development directory of
package, the bib file is first sought there before resorting to
the installation directory.
Although the base R packages do not have files REFERENCES.bib,
package can be set to one of them,
"base". This works since package bibtex provides bib
files for the core packages.
get_bibentries escapes unescaped percent signs in
all fields of bibtex objects. To restrict this only to field "url",
get_bibentries returns an object from class
"bibentryRd", which inherits from bibentry. The printing method
"bibentryRd" unescapes percent signs in URLs for some
styles where the escapes are undesirable.
a bibentryRd object inheriting from bibentry
Georgi N. Boshnakov
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
r <- get_bibentries(package = "Rdpack") r print(r, style = "html") b <- get_bibentries(package = "stats") print(b[], style = "R") print(b[], style = "citation") ## here the url field contains percent encoding fn_url <- system.file("examples", "url_with_percents.bib", package = "Rdpack") u <- get_bibentries(bibfile = fn_url) ## the links produced by all of the following are valid ## and can be put in a browser print(u, style = "html") print(u, style = "bibtex") print(u, style = "R") print(u, style = "text") print(u, style = "citation") ## The link here contains escapes but when put in a LaTeX document ## which uses the JSS style it generates correct clickable link, ## (see Details section) print(u, style = "latex") ## here the journal field contains percent encoding fn_other <- system.file("examples", "journal_with_percents.bib", package = "Rdpack") j <- get_bibentries(bibfile = fn_url) print(j, style = "html") print(j, style = "bibtex") print(j, style = "R") print(j, style = "text") print(j, style = "citation") print(j, style = "latex")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.