ondemandfoki.blogg.se

Figure caption rmarkdown
Figure caption rmarkdown






  1. #Figure caption rmarkdown how to
  2. #Figure caption rmarkdown code

SumLW <- rbind(Summarize(~length,data=RuffeSLRH92), tbls("SumLW1","Summary statistics of the length and weight of Ruffe captured in 1992.") For example, see Table 1, which is related to Figure 1 and Figure 2. hist(~weight,data=RuffeSLRH92)įigure 2: Weight frequency of Ruffe captured in 1992.

#Figure caption rmarkdown code

For example, figs("LenFreq1",display="cite") inside an inline R call would produce a reference to Figure 1.Īs more functions are added, the figure numbers are incremented such that inline R code may refer to Figure 2 and Figure 1.

figure caption rmarkdown

In addition, use inline R code to refer to the figure. hist(~length,data=RuffeSLRH92)įigure 1: Length frequency of Ruffe captured in 1992. For example, the chunk below is followed by an inline R chunk of Figure 1: Length frequency of Ruffe captured in 1992. The figs function may be used to add a figure caption to a figure. The results returned by this function are exploited, as shown in the next section, to solve the figure referencing problem.

figure caption rmarkdown

# "Figure 1: Length frequency of Ruffe captured in 1992." The same function may then be used to retrieve the function name with a number, the figure number with a prefix, or the figure number. figs(name="LenFreq1","Length frequency of Ruffe captured in 1992.")įigs(name="WtFreq1","Weight frequency of Ruffe captured in 1992.") I prefer to create all tags and captions in one chunk (and use results='hide' to hide the immediate display of the information). For example, the code below creates tag and caption combinations for two figures. Initially, these functions are called with two arguments – the figure or table tag and the figure or table caption. These functions can be used to create on object that holds a tag, caption, and number for figures or tables, respectively. The result of this code is two functions – one called figs that will hold a list of tags and captions for figures and another called tbls that will hold the same for tables.

figure caption rmarkdown

Below, I initialize a function for creating captoins for figures and tables. The prefix= argument sets the common prefix for all items of a certain type. Separate captioner objects must be initialized for handling figures and tables. The Solution Foundationįor a simple example, I load FSAdata for the RuffeSLRH92 data, FSA for hist() and summarize(), and knitr for kable (to produce an RMarkdown table). The examples below illustrate how I have been using captioner to solve this problem.

#Figure caption rmarkdown how to

One issue that has slowed my conversion has been my struggles with how to reference figures and tables. I have been attempting to use RMarkdown rather than LaTeX to produce R examples.








Figure caption rmarkdown