Referencing a 'hand-made' table using bookdown package

I am joining the discussion a bit late, but I just wanted to share a working MWE (based on the earlier answers):

```{r , echo=FALSE, results='asis'}
  cat(' Table: (\\#tab:mwe) Example

  | Sepal.Length| Sepal.Width| Petal.Length|
  |------------:|-----------:|------------:|
  |          5.1|         3.5|          1.4|
  |          4.9|         3.0|          1.4|
  |          4.7|         3.2|          1.3|
  |          4.6|         3.1|          1.5|')

```

Table @ref(tab:table2) shows...


I solved this with the following:

```{r table2 , echo=FALSE, results='asis'}
  cat(' Table: \\label{tab:table2}Example
  
  | Sepal.Length| Sepal.Width| Petal.Length|
  |------------:|-----------:|------------:|
  |          5.1|         3.5|          1.4|
  |          4.9|         3.0|          1.4|
  |          4.7|         3.2|          1.3|
  |          4.6|         3.1|          1.5|')
  
```

If you write text and want to reference the table, you can write in table \ref{tab:table2} the results are shown.


I did mention it in the documentation, but perhaps it is not clear enough. I said you need the label of the form (\#tab:...). For example, you may refer to this table using \@ref(tab:foo).

Table: (\#tab:foo) Your table caption.

| Sepal.Length| Sepal.Width| Petal.Length|
|------------:|-----------:|------------:|
|          5.1|         3.5|          1.4|
|          4.9|         3.0|          1.4|
|          4.7|         3.2|          1.3|
|          4.6|         3.1|          1.5|