Skip to content

Commit 3ceb826

Browse files
committed
added kable_styling(latex_options = hold_position) to hold table positions
1 parent 5c01e2a commit 3ceb826

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

classification1.Rmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
library(formatR)
55
library(plotly)
66
library(knitr)
7+
library(kableExtra)
78
89
knitr::opts_chunk$set(echo = TRUE,
910
fig.align = "center")
@@ -502,7 +503,10 @@ math_table <- math_table %>%
502503
```
503504

504505
```{r 05-multiknn-mathtable, echo = FALSE}
505-
knitr::kable(math_table, booktabs = TRUE, caption = "Evaluating the distances from the new observation to each of its 5 nearest neighbors", escape = FALSE)
506+
kable(math_table, booktabs = TRUE,
507+
caption = "Evaluating the distances from the new observation to each of its 5 nearest neighbors",
508+
escape = FALSE) |>
509+
kable_styling(latex_options = "hold_position")
506510
```
507511

508512
The result of this computation shows that 3 of the 5 nearest neighbors to our new observation are

viz.Rmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
library(tidyverse)
55
library(cowplot)
66
library(knitr)
7+
library(kableExtra)
8+
79
knitr::opts_chunk$set(fig.align = "center")
810
```
911

@@ -1472,7 +1474,8 @@ file_sizes <- tibble(`Image type` = c("Raster",
14721474
paste(round(file.info("img/faithful_plot.svg")["size"]
14731475
/ 1000000, 2), "MB")))
14741476
kable(file_sizes,
1475-
caption = "File sizes of the scatter plot of the Old Faithful data set when saved as different file formats.")
1477+
caption = "File sizes of the scatter plot of the Old Faithful data set when saved as different file formats.") |>
1478+
kable_styling(latex_options = "hold_position")
14761479
```
14771480

14781481
Take a look at the file sizes in Table \@ref(tab:filesizes).

0 commit comments

Comments
 (0)