Learn R Programming

svSweave (version 1.0.0)

fig_id: 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

Run this code
# NOT RUN {
fig_id("my_label")
# }

Run the code above in your browser using DataLab