rmarkdown中向量中的交叉引用

时间:2020-05-31 17:53:48

标签: r-markdown bookdown stargazer cross-reference

我尝试在使用Appendix时交叉引用character vector中的rmarkdown部分。实际上,character vector函数中使用了stargazer来引用Appendix。以下是我的stargazer函数-

stargazer(as.data.frame(sum_stat[c(
  "DEGREE", 
  "EIGENVECTOR", 
  "BETWEENNESS", 
  "CLOSENESS", 
  "OVERALLCENTRALITY",
  "LNASSETS",
  "LEVERAGE", 
  "INVREC", 
  "LOSS",
  "ROA", 
  "ZSCORE",
  "MERGER",
  "MTB",
  "FOREIGN",
  "EXTRAORDINARY",
  "SEGMENT",
  "SPECIALIZED",
  "MATERIALWEAKNESS",
  "RESTATEMENT",
  "BIGN",
  "GOINGCONCERN",
  "CALENDARYEAR",
  "LNNONAUDFEES",
  "LNAUDFEES",
  "AUDTURNOVER",
  "RESTRUCTURE",
  "LITIGATE",
  "AGE", 
  "AUDITORTENURE",
  "AUDITLAG", 
  "AUDFEES",
  "NAUDFEES")]),
  summary.stat = c("n", "mean", "sd", "p25", "median", "p75"),
  column.sep.width = "1pt",
  title= "Summary Stat of Variables", type = "latex",
  label="tab:mysummarytable",
  digits= 1, 
  header = FALSE,
  notes.align = "l",
  font.size = "scriptsize",
  single.row = T,
  no.space = T,
  covariate.labels = sumstat_label,
  notes = c(
    "All variables are defined in Appendix A",
    "All continuous variables are winsorized at 1 and 99 percent.",
    "The Pctl (25(75)) corresponds to 25th and 75th percentile."
  )
)

notes参数中,第一个元素是"All variables are defined in Appendix A"。实际上,我想交叉引用,即notes参数中的附录A 。我通过以下方式创建了文档的Appendix部分-

\appendix

# (APPENDIX) Appendix {-} 

# Appendix A
\label{appendix:a}

rmarkdown的正文中,我通过以下代码cross refer \ref{appendix:a} 附录A ,该代码工作得很好。当我在以上\ref{appendix:a}的{​​{1}}参数中使用notes时,它不起作用。我像这样创建向量的第一个元素-stargazer,它不起作用。

请注意,这是"All variables are defined in Appendix \ref{appendix:a}"-

中的output部分
YAML

0 个答案:

没有答案