fig_id: Create a figure id from a chunk label

View source: R/new_labelling.R

fig_idR Documentation

Create a figure id from a chunk label

Description

This function looks at the current chunk label and returns id="fig:label" that is usable in the out.extra= field of the R chunk. It allows to refer to a figure generated from a chunk with this label. Use out.extra=chunk_id() to set the id, or use fig_id_auto().

Usage

fig_id(label)

fig_id_auto()

Arguments

label

The label to use. If provided, it supersedes the chunk label.

Value

A string to set the id like id="fig:label". For fig_id_auto(), the function installs a hook in 'knitr' to add an id automatically for each plot make by changing out.extra=.

Examples

fig_id("my_label")

svSweave documentation built on May 10, 2022, 5:06 p.m.