printr v0.1


Monthly downloads



Automatically Print R Objects to Appropriate Formats According to the 'knitr' Output Format

Extends the S3 generic function knit_print() in 'knitr' to automatically print some objects using an appropriate format such as Markdown or LaTeX. For example, data frames are automatically printed as tables, and the help() pages can also be rendered in 'knitr' documents.



Build Status

This is a companion package to knitr. Its main purpose is to extend the S3 generic function knit_print() in knitr, which is the default value of the chunk option render, as explained in the vignette knit_print.html.

It has not been released to CRAN yet, and you can install the development version from my personal repo for now:

  type = 'source',
  repos = c('', '')

To enable the printing methods defined in this package, just library(printr) in a code chunk (in the beginning) of your knitr document. Then some objects will be printed differently with what you would have seen in a normal R console. For example:

  • matrices, data frames, and contingency tables are printed as tables (LaTeX, HTML, or Markdown, depending on your output format)
  • the help page (from ?foo or help(foo)) can be rendered as HTML, LaTeX, or plain text, and you can also specify which section(s) of the help page to include in the output
  • the results from browseVignettes(),, data(), and vignette() are rendered as tables
  • the package information from library(help = 'foo') is rendered as plain text

For more information, please check out the package vignette:

vignette('printr', package = 'printr')

You are welcome to contribute more S3 methods to this package, and you may want to read the existing methods in this package before you get started. In most cases, I guess you will end up rendering either plain text (see knit_print.packageInfo for example) or tables (see knit_print.matrix) in the output.

Functions in printr

Name Description
printr Print R objects in
No Results!

Vignettes of printr

No Results!

Last month downloads


Type Package
Date 2017-05-19
License GPL
VignetteBuilder knitr
LazyData TRUE
RoxygenNote 6.0.1
NeedsCompilation no
Packaged 2017-05-18 21:08:46 UTC; yihui
Repository CRAN
Date/Publication 2017-05-19 06:24:13 UTC
imports knitr (>= 1.16)
suggests rmarkdown , tools
Contributors Yihui Xie

Include our badge in your README