-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTutorial4.Rmd
41 lines (31 loc) · 892 Bytes
/
Tutorial4.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: "Learning to reference figures, tables, and sections"
author: "Xuanming"
date: "`r Sys.Date()`"
output:
bookdown::html_document2
keep_md: TRUE
---
```{r global, include = FALSE}
knitr::opts_chunk$set(fig.align = "center")
```
```{r, message = FALSE}
library(tidyverse)
```
# Learning to reference figures {#figures}
```{r FigRef, fig.cap = "This is a line plot."}
x = seq(1:100)
y = rnorm(100)
dat = data.frame(x, y)
ggplot(dat, aes(x = x, y = y)) +
geom_line()
```
In Figure \@ref(fig:FigRef), we have plot x versus y.
# Learning to reference tables {#tables}
In Table \@ref(tab:TabRef), we have shown the first five rows of the data.
```{r TabRef}
head(dat, n = 5) %>%
knitr::kable(caption = "First five rows of the data.")
```
# Learning to reference sections
In Section \@ref(figures), we plot a figure. While in Section \@ref(tables), we produce a table.