I try to cross-reference a table in R Markdown. When I render the document (whether to .html or to .pdf), it simply prints "??" instead of the reference. output
Here is what my code looks like.
---
title: "reproducible example"
date: "2023-04-13"
output:
  bookdown::html_document2: default
  bookdown::pdf_document2: default
---
My reference \@ref(tab:test)
```{r test, echo=FALSE}
library(tidyverse)
kableExtra::kable(tibble(variable= "hello", another = "bye"))```
Any ideas? Thank you!
I use the latest version of Rstudio as well as these packages:
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.3.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
 [1] kableExtra_1.3.4 lubridate_1.9.2  forcats_1.0.0    stringr_1.5.0    dplyr_1.1.1      purrr_1.0.1     
 [7] readr_2.1.4      tidyr_1.3.0      tibble_3.2.1     ggplot2_3.4.2    tidyverse_2.0.0 
loaded via a namespace (and not attached):
 [1] highr_0.10        compiler_4.2.2    pillar_1.9.0      tools_4.2.2       digest_0.6.31     timechange_0.2.0 
 [7] evaluate_0.20     lifecycle_1.0.3   gtable_0.3.3      viridisLite_0.4.1 pkgconfig_2.0.3   rlang_1.1.0      
[13] cli_3.6.1         rstudioapi_0.14   yaml_2.3.7        xfun_0.38         fastmap_1.1.1     withr_2.5.0      
[19] httr_1.4.5        xml2_1.3.3        knitr_1.42        hms_1.1.3         generics_0.1.3    vctrs_0.6.1      
[25] systemfonts_1.0.4 tidyselect_1.2.0  webshot_0.5.4     grid_4.2.2        svglite_2.1.1     glue_1.6.2       
[31] R6_2.5.1          fansi_1.0.4       rmarkdown_2.21    tzdb_0.3.0        magrittr_2.0.3    scales_1.2.1     
[37] htmltools_0.5.5   MASS_7.3-58.3     rvest_1.0.3       colorspace_2.1-0  utf8_1.2.3        stringi_1.7.12   
[43] munsell_0.5.0
 
     
    
