refer.figure: Cite a figure, table, literature, text, URL link or generate...

View source: R/oop.R

referR Documentation

Cite a figure, table, literature, text, URL link or generate inline R/HTML code

Description

Generates an inline citation to a figure, mdtable object or literature references, currently only in the bookdown style. For mdbib objects, it inserts a citation to a all entries of a bibliography entries (e.g. '[@citation1; @citation2; ...]'). In combination with the reglook.mdbib or the tidyverse's 'filter()' method, it can be used to search a bibliography object and paste the selected citations into an Rmarkdown document. For mdexpr, mdhtml and mdtext objects storing R, HTML code and ordinary text, respectively, an inline text is generated. For mdlinks a link in the markdown or html format is generated.

Usage

refer(object, ...)

## S3 method for class 'figure'
refer(object, file = NULL, append = TRUE, ...)

## S3 method for class 'mdtable'
refer(object, file = NULL, append = TRUE, ...)

## S3 method for class 'mdexpr'
refer(object, file = NULL, append = TRUE, ...)

## S3 method for class 'mdbib'
refer(object, file = NULL, append = TRUE, ...)

## S3 method for class 'mdtext'
refer(object, file = NULL, append = TRUE, ...)

## S3 method for class 'mdlink'
refer(
  object,
  title = object$ref_name,
  html = FALSE,
  file = NULL,
  append = TRUE,
  ...
)

## S3 method for class 'mdhtml'
refer(object, file = NULL, append = TRUE, ...)

Arguments

object

an object to be referenced.

...

extra arguments, currently none.

file

a file to which the references or code are written. If the file exists already, it will be appended or overwritten. If NULL, the text is printed in the console and copied into the clipboard.

append

logical, should the output file be appended?

title

a string to be used as a link title, defaults to the 'ref_name' of the mdlink object.

html

logical, should the link be in a HTML format? Defaults to FALSE.

Details

To enable the clipboard access, you may need to set the CLIPR_ALLOW environment variable to TRUE, as described for write_clip. 'refer()' is a S3 generic function.


PiotrTymoszuk/figur documentation built on July 16, 2024, 1:15 a.m.