Skip to content

Commit ac2168e

Browse files
Merge pull request #107 from tidymodels/fix-103
Make vignette more reactive
2 parents fefe387 + 1b4f671 commit ac2168e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Suggests:
4646
testthat (>= 3.0.0),
4747
workflows (>= 1.1.2)
4848
Config/Needs/website: pkgdown, tidymodels, tidyverse, palmerpenguins,
49-
patchwork, ggforce
49+
patchwork, ggforce, tidyverse/tidytemplate
5050
Config/testthat/edition: 3
5151
Encoding: UTF-8
5252
Roxygen: list(markdown = TRUE)

vignettes/articles/k_means.Rmd

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,17 @@ kmeans_fit %>%
168168
extract_centroids()
169169
```
170170

171-
Based on the above output, we might say that Cluster_1 is penguins with smaller
172-
bill lengths, Cluster_2 has smaller bill depths, and Cluster_3 is penguins with
171+
```{r, echo=FALSE}
172+
centroids <- extract_centroids(kmeans_fit)
173+
174+
small_length <- centroids$.cluster[which.min(centroids$bill_length_mm)]
175+
small_depth <- centroids$.cluster[which.min(centroids$bill_depth_mm)]
176+
other <- setdiff(levels(centroids$.cluster), c(small_length, small_depth))
177+
```
178+
179+
180+
Based on the above output, we might say that `r small_length` is penguins with smaller
181+
bill lengths, `r small_depth` has smaller bill depths, and `r other` is penguins with
173182
large bills in both dimensions.
174183

175184
## Prediction

0 commit comments

Comments
 (0)