dn_counter | R Documentation |
The counter is configurable and queryable to show what has already been done. It provides an alternative to the bookdown word_document2 format.
The counter is an R6 object, that can be created with dn_counter$new()
.
It has the following arguments:
The text to prefix to the number. Normally one would use "Figure " or "Table " (note the spaces).
The character to use to replace " " if using the prefix as part of a file name.
A second prefix to add, if you need "S" for supplemental, for example.
"yes" or "no". Default is "no".
There is one function to add to the counter, dn_counter$increment("name")
increases the count and adds the name to the count for recall later.
dn_counter$label_text("name")
returns a text string for use in text,
"Figure 1" for example.
dn_counter$label_caption("name")
returns a text string to use in a caption.
dn_counter$just_count("name")
returns just the count as a string, with prefix2 if it was supplied.
dn_counter$label_file("name")
returns a text string for use as part of
a file name, "Figure_1" as an example.
dn_counter$rename("old_name", "new_name")
replaces the names on the count
object so that you can refer to the correct one.
dn_counter$modify_path(oldpath, label)
generates a new path filename that incorporates the figure number.
This is most useful with knitr::opts_chunk$set(fig.process = my_counter$modify_path)
.
dn_counter
displays the prefix, file replacement text, the current set of
counts, and their names.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.