From the course: Creating Reports and Presentations with R Markdown and RStudio
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Captions with bookdown - RStudio Tutorial
From the course: Creating Reports and Presentations with R Markdown and RStudio
Captions with bookdown
- [Instructor] If you want to us captions and cross-references in your RMarkdown files, then the best bet is to switch to Bookdown output formats. If you're using HTML documents, switch instead to Bookdown HTML document two, and if you're using PDF document, switch to Bookdown PDF document two. Once you've done that, it's very easy to insert captions into your document. For figures, use the fig.cap code chunk option. The caption provided to fig.cap will be displayed at the bottom of the figure. If you want to add captions to tables, then use the caption argument of the kable function. When you do this, captions will appear at the top of your table. You can cross-reference citations with slash @ref. Bookdown numbers both table and figures separately. To refer to a figure, use fig and to refer to it to a table, use tab. Refer to the specific figure or table that you wish to refer to by the code chunk name. For recap on code chunks, try to always name code chunks sensibly, only use…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.