Skip to content

Suggested edit to simple table cross-referencing documentation #972

Open
@DanOvando

Description

@DanOvando

Given the new interactive table generator in the RStudio preview visual markdown editor, it seems like those sorts of simple tables might get an uptick in use (I find them really handy for generating text-heavy tables, as opposed to trying to shoehorn the content into a dataframe and passing to knitr::kable)

I found the cross-referencing documentation for these types of tables to be a little confusing though. I would suggest something like this instead (this could be updated once the visual markdown editor becomes part of the standard RStudio release to reflect the format created by the interactive table generator?)

Pandoc supports several types of Markdown tables, such as simple tables, multiline tables, grid tables, and pipe tables. You can write your own simple table directly in markdown like this:

Table:(\#tab:simple-table) A simple table in Markdown.
 Sepal.Length   Sepal.Width   Petal.Length   Petal.Width
-------------  ------------  -------------  ------------
          5.1           3.5            1.4           0.2
          4.9           3.0            1.4           0.2
          4.7           3.2            1.3           0.2
          4.6           3.1            1.5           0.2
          5.0           3.6            1.4           0.2
          5.4           3.9            1.7           0.4

Which will produce this table when the document is knit

Table:(#tab:simple-table) A simple table in Markdown.

Sepal.Length Sepal.Width Petal.Length Petal.Width


      5.1           3.5            1.4           0.2
      4.9           3.0            1.4           0.2
      4.7           3.2            1.3           0.2
      4.6           3.1            1.5           0.2
      5.0           3.6            1.4           0.2
      5.4           3.9            1.7           0.4

You can then cross-reference this simple table using \@ref(tab:simple-table), creating Table.@ref(tab:simple-table).

Table: A simple table in Markdown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bookAbout the bookdown book contains in inst/examplesdocumentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions