add_table: Format data in a markdown table suitable for publication,...

View source: R/add_table.R

add_tableR Documentation

Format data in a markdown table suitable for publication, with comma separation on numbers

Description

Add a table in Rmarkdown suitable for publication in govspeak and in word/PDF

Usage

add_table(data, format.args = list(big.mark = ","), bold_cols = NULL)

Arguments

data

dataframe; dataframe of any size to be displayed as a table

format.args

additional format arguments to be passed to the table.

bold_cols

vector; vector of column names or column positions to be bolded in the table Defaults to comma thousands separation

Value

a markdown formatted table as a string

Examples

add_table(mtcars)
##Example with comma formatted values
add_table(data.frame(datasets::EuStockMarkets))
##Example with format.args set to null
add_table(data.frame(datasets::EuStockMarkets), format.args = NULL)
##Example with bold_cols set to a vector of column names
add_table(data.frame(datasets::EuStockMarkets), bold_cols = c("DAX", "SMI"))
##Example with bold_cols set to a vector of column positions
add_table(data.frame(datasets::EuStockMarkets), bold_cols = c(1, 2))


moj-analytical-services/mojspeakr documentation built on April 13, 2025, 9 p.m.