以下 MWE 應通過參考它正確顯示圖形的編號, \@ref(fig:chunk-label)但該函式未找到該參考。是否有任何選項我必須添加到塊標頭以實作正確的參考?
兆瓦:
---
title: "Untitled"
author: "dsf"
date: "18 1 2022"
output:
bookdown::pdf_document2:
keep_tex: yes
fig_caption: true
number_sections: true
toc: true
lot: true
lof: true
graphics: true
---
```{r decision-tree, fig.cap="Decision Tree Example for the strava irmi dataset", echo= FALSE, message = FALSE}
library(rpart)
library(rattle)
library(tidyverse)
attach(mtcars)
train <- mtcars
train <- train %>%
mutate(across( .cols = everything(), ~scale(.x)))
# Create a decision tree model
tree <- rpart(mpg~., data=train, cp=.05)
# Visualize the decision tree with rpart.plot
fancyRpartPlot(tree,yesno=2,split.col="black",nn.col="black",
caption="Decision Tree Example for the irmi dataset",palette="Set3",branch.col="black")
```
Figure \@ref(fig:decision-tree) shows an example of an decision tree for the irmi dataset.
編輯:感謝斯蒂芬。我關注
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/414679.html
標籤:
下一篇:在每組中繪制參考資料的密度圖網格
