【发布时间】:2020-01-19 22:44:21
【问题描述】:
在 bookdown 中途交叉引用 texreg 制作的表格。该表已正确编号,但交叉引用以“??”结尾在文本中。下面是一个 MRE。有没有办法解决这个问题,或者是否有其他包可以解决这个问题(stargazer 在 bookdown 中有同样的问题)。使用fig.cap 无效。
感谢您的帮助。
---
title: "bookdownTest"
author: "Richard Sherman"
date: "1/9/2020"
output:
bookdown::pdf_document2:
fig_caption: yes
toc: false
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r load libraries, include=FALSE}
library(texreg)
library(bookdown)
```
```{r lm, results='asis', star.symbol = "\\*", center = TRUE}
m1 <- lm(mpg ~ disp + cyl + hp, mtcars)
m2 <- lm(mpg ~ disp + hp, mtcars)
texreg(list(m1, m2), center = TRUE,
caption="Linear model of mpg")
```
Results are in Table \@ref(tab:lm).
【问题讨论】:
标签: r r-markdown bookdown texreg