| Title: | Read Markdown Tables into Tibbles |
| Version: | 0.4.0 |
| Description: | Efficient reading of raw markdown tables into tibbles. Designed to accept content from strings, files, and URLs with the ability to extract and read multiple tables from markdown for analysis. |
| Depends: | R (≥ 4.1.0) |
| Imports: | cli, httr2, lifecycle, readr (≥ 2.2.0), purrr, stringr |
| URL: | https://github.com/jrdnbradford/readMDTable, https://jrdnbradford.github.io/readMDTable/ |
| BugReports: | https://github.com/jrdnbradford/readMDTable/issues |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| Config/roxygen2/version: | 8.0.0 |
| Config/roxygen2/markdown: | TRUE |
| Suggests: | covr, devtools, dplyr, ggplot2, knitr, lubridate, microbenchmark, precommit, rmarkdown, rvest, testthat (≥ 3.0.0), tibble, usethis |
| Config/testthat/edition: | 3 |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-06-23 17:13:40 UTC; bradfojb |
| Author: | Jordan Bradford |
| Maintainer: | Jordan Bradford <jrdnbradford@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-24 05:20:02 UTC |
readMDTable: Read Markdown Tables into Tibbles
Description
Efficient reading of raw markdown tables into tibbles. Designed to accept content from strings, files, and URLs with the ability to extract and read multiple tables from markdown for analysis.
Author(s)
Maintainer: Jordan Bradford jrdnbradford@gmail.com (ORCID) [copyright holder]
Authors:
Jordan Bradford jrdnbradford@gmail.com (ORCID) [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/jrdnbradford/readMDTable/issues
Read Markdown Tables into Tibbles
Description
Read Markdown Tables into Tibbles
Usage
read_md_table(file, warn = TRUE, force = FALSE, ...)
extract_md_tables(file, warn = TRUE, force = FALSE, ...)
extract_md_table(file, warn = TRUE, force = FALSE, ...)
Arguments
file |
Either a path to a file, a connection, or literal data (either
a single string or a raw vector). Files starting with |
warn |
Boolean. Should warnings be raised if |
force |
Boolean. Should |
... |
Arguments passed on to
|
Details
read_md_table reads all markdown tables from a string, file, or
URL and returns them as a named list of tibbles. It uses
readr::read_delim to efficiently read in data.
If warn is TRUE, read_md_table will warn if no markdown tables are
detected in the content. When force is also TRUE, it will attempt to
read the content as a table anyway. readr::read_delim will provide its
own warnings if there are potential issues with a table.
Value
A named list of tibbles (names "table_1", "table_2", …), or
NULL if no tables are found and force is FALSE.
Examples
# Read a single table from a file
read_md_table(read_md_table_example("mtcars.md"))
# Read multiple tables from a file
read_md_table(read_md_table_example("mtcars-split.md"), show_col_types = FALSE)
# 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
)
Get Path to readMDTable Examples
Description
Get Path to readMDTable Examples
Usage
read_md_table_example(file = NULL)
Arguments
file |
Name of file. If |
Details
readMDTable comes with a number of well-known datasets as example
markdown tables in the inst/extdata directory. read_md_table_example
will list the file names or return the path of a specified file.
Value
Vector of example file names if file is NULL, else the path
to the example markdown table file.
Examples
# List the available example files
read_md_table_example()
# Get the path to the mtcars example file
read_md_table_example("mtcars.md")
# Read in an example file
mtcars_path <- read_md_table_example("mtcars.md")
read_md_table(mtcars_path)