rr-markdownreportstargazerquarto

Quarto cross reference with stargazer


I have a regression output which I use stargazer to report it in HTML format:

```{r, echo=FALSE}
#| label: tbl-reg-cox
#| tbl-cap: "Cox-estimations of first permit event"
#| output: asis

stargazer::stargazer(
    cox1,
    title="Cox regression",
    type="html",
    apply.coef = exp,
    df = FALSE
)

```

I want to reference it in Quarto markdown (.qmd) file, but when I am rendering it, Quarto Preview warns:

WARNING: Unable to resolve crossref @tbl-reg-cox 

and the link appears as:

Table ?@tbl-reg-cox

Can you tell me what am I doing wrong? or are there any alternative to cross reference a code chunk?

thank you!


Solution

  • Instead of using stargazer, use huxtable. Huxtable support all features that stargazer provides as well as several models including cox proportional hazard.

    huxtable::huxreg(
        cox1,
        title="Cox regression",
        tidy_args = list(exponentiate = TRUE)
    )