Skip to content

Commit 061fef3

Browse files
committed
added setup code
1 parent 296ab28 commit 061fef3

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

classification2.Rmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
```{r classification2-setup, echo = FALSE, message = FALSE, warning = FALSE}
44
library(gridExtra)
55
library(cowplot)
6+
library(stringr)
67
78
knitr::opts_chunk$set(fig.align = "center")
89

regression1.Rmd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,27 @@
33
```{r regression1-setup, echo = FALSE, message = FALSE, warning = FALSE}
44
library(knitr)
55
library(plotly)
6+
library(stringr)
67
78
knitr::opts_chunk$set(fig.align = "center")
89
reticulate::use_miniconda('r-reticulate')
10+
11+
print_tidymodels <- function(tidymodels_object) {
12+
if(!is_latex_output()) {
13+
tidymodels_object
14+
} else {
15+
output <- capture.output(tidymodels_object)
16+
17+
for (i in seq_along(output)) {
18+
if (nchar(output[i]) <= 80) {
19+
cat(output[i], sep = "\n")
20+
} else {
21+
cat(str_sub(output[i], start = 1, end = 80), sep = "\n")
22+
cat(str_sub(output[i], start = 81, end = nchar(output[i])), sep = "\n")
23+
}
24+
}
25+
}
26+
}
927
```
1028

1129
## Overview

regression2.Rmd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,27 @@
33
```{r regression2-setup, echo = FALSE, message = FALSE, warning = FALSE}
44
library(knitr)
55
library(plotly)
6+
library(stringr)
67
78
knitr::opts_chunk$set(fig.align = "center")
89
reticulate::use_miniconda('r-reticulate')
10+
11+
print_tidymodels <- function(tidymodels_object) {
12+
if(!is_latex_output()) {
13+
tidymodels_object
14+
} else {
15+
output <- capture.output(tidymodels_object)
16+
17+
for (i in seq_along(output)) {
18+
if (nchar(output[i]) <= 80) {
19+
cat(output[i], sep = "\n")
20+
} else {
21+
cat(str_sub(output[i], start = 1, end = 80), sep = "\n")
22+
cat(str_sub(output[i], start = 81, end = nchar(output[i])), sep = "\n")
23+
}
24+
}
25+
}
26+
}
927
```
1028

1129
## Overview

0 commit comments

Comments
 (0)