align_pander {docxtools}R Documentation

Align the columns of a pander table.

Description

Uses pander() to print a data frame as a table to the output document.

Usage

align_pander(x, align_idx = NULL, caption = NULL)

Arguments

x

A data frame to be printed in the output document.

align_idx

Optional string made up of l (left-aligned), r (right-aligned), and c (center-aligned).

caption

Optional string used as the pander() caption argument.

Details

Uses panderOptions('table.alignment.default') argument to assign output column alignment. The default alignments are numeric right and everything else left.

If align_idx is not NULL, a warning message is generated if its string length does not match the number of columns in the table.

The function also sets these pander options as defaults:

Value

Prints the data frame in table form using pander(x).

Examples

x <- mtcars[1:5, 1:5]
align_pander(x)
align_pander(x, align_idx = "rcrrr")
align_pander(x, caption = "A nicely formatted table")


[Package docxtools version 0.1.3 Index]