mdTable: Markdown tables

View source: R/mdTable.R

mdTableR Documentation

Markdown tables

Description

Markdown tables with pandoc-crossref support

Usage

mdTable(x, col.just = "r", guessGroup = FALSE, ..., mdToTex = "auto")

Arguments

x

a matrix or data frame

col.just

horizontal justification of text in cells

guessGroup

attempt to guess cgroup and rgroup, for reshape2 output

...

other arguments for latex, htmlTable or kable.

mdToTex

if FALSE convert to markdown table, return x otherwise

Details

latex is called if mdToTex is TRUE. Otherwise, htmlTable is called if arguments such as cgroup are present and kable is called to produce a markdown table.

Captions with labels suitable for pandoc-crossref are added. If not provided, the label is tbl: followed by the chunk label.

When mdToTex is 'auto' (the default), it is set to any(commandArgs()=='mdToTex', na.rm=TRUE)

Value

character string which knitr prints 'asis'

Examples

mytable = as.data.frame(matrix(runif(6),,3))
names(mytable) = month.name[1:ncol(mytable)]

cat(mdTable(x=mytable, digits=3,
  caption = 'the table', caption.loc='bottom',
mdToTex=FALSE))


Pmisc documentation built on March 5, 2025, 3 a.m.