
Formatting tools for R markdown documents.
Provides a small set of tools for formatting tasks when writing documents in R Markdown or Quarto Markdown. Works with outputs in html, pdf, docx and possibly others.
# Packages
library("formatdown")
library("data.table")format_power() Convert the elements
of a numerical vector to character strings in which the numbers are
formatted using powers-of-ten notation in scientific or engineering form
and delimited for rendering as inline equations in an R Markdown
document.
# Scientific notation
format_power(101100, digits = 4, format = "sci")
#> [1] "$1.011\\times{10}^{5}$"
# Engineering notation
format_power(101100, digits = 4, format = "engr")
#> [1] "$101.1\\times{10}^{3}$"which, in an Rmd or qmd document, are rendered as
Install from CRAN.
install.packages("formatdown")The development version can be installed from GitHub.
install.packages("devtools")
devtools::install_github("graphdr/formatdown")To contribute to formatdown,
inst/tinytest/ directory.To provide feedback or report a bug,
# Detailed test results
test_results <- tinytest::test_package("formatdown")
as.data.frame(test_results)Participation in this open source project is subject to a Code of Conduct.