View source: R/read_md_table.R
read_md_table | R Documentation |
Read a Markdown Table into a Tibble
read_md_table(file, warn = TRUE, force = FALSE, ...)
read_md_table
reads a markdown table into a tibble from a string,
file, or URL. It uses readr::read_delim
to efficiently read in data.
read_md_table
expects file
to be a raw markdown table. If file
is a
markdown file that contains more than just a table or tables, the table(s)
should be read in with extract_md_tables
instead.
If warn
is TRUE
, read_md_table
will warn if there are potential
issues with the provided markdown table. Depending on the issue,
read_md_table
may still correctly read the table if force
is
TRUE.
readr::read_delim
will provide its own warnings if
there are potential issues.
A tibble created from the markdown table, or NULL
.
# Read from a file
read_md_table(read_md_table_example("mtcars.md"))
# Read from a string
read_md_table(
"| H1 | H2 | \n|-----|-----|\n| R1C1 | R1C2 |\n| R2C1 | R2C2 |",
warn = FALSE,
force = TRUE
)
# Read from a URL
read_md_table(
"https://raw.githubusercontent.com/jrdnbradford/readMDTable/main/inst/extdata/iris.md"
)
# Get warning for malformed tables
read_md_table(
"| Name | Age | City | Date |
|-------|-----|-------------|------------|
| Alice | 30 | New York | 2021/01/08 |
| Bob | 25 | Los Angeles | 2023/07/22 |
Carol | 27 | Chicago | 2022/11/01 ",
force = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.