We can make a bunch of figure captions without worrying about messing up the table numbering. Here, you don’t need to designate the prefix because the default is already set to “Figure”. All you need to do is create a new captioner() function: fig_nums <- captioner() You don’t want the numbering of the two to get mixed up, and you also don’t want all of your figures to have the “Table” prefix. Now suppose you not only have a set of tables, but also a set of figures. All measurements are in centimetres.Īnd is as good as what the fig.cap command will do for you. R markdown is pretty finicky about displaying captions, though, so it is probably easiest to use an in-line R code chunk to display the caption: ` r table_nums("iris") ` If you want to use the caption in a formal R markdown caption, you can also store it in its own object and use the fig.cap command within your R markdown code chunk iris_cap <- table_nums( "iris")Īnd your chunk header might look like: The caption is automatically stored, so you can always reference it using the supplied keyword: table_nums( "iris") # "Table 1: Edgar Anderson's iris data. All measurements are in centimetres.") # "Table 1: Edgar Anderson's iris data. Now you can create your first caption: table_nums( name = "iris", caption = "Edgar Anderson's iris data. The display options are:įull or f (default): Display the caption with prefix and numberĬite or c: Display the prefix and number only The function, table_nums takes 4 arguments: a key word to describe your table ( name), a caption ( caption), a character string (or logical) to set the display mode ( display), and a logical ( level) related to hierarchical numbering (discussed below). Table_nums <- captioner( prefix = "Table") The default prefix is “Figure”, but you can use anything you want. When you create your function, you can also designate a prefix that will go before the figure number (e.g.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |