Skip to content
Some (magical) printing methods for knitr
Branch: master
Clone or download

Latest commit


Type Name Latest commit message Commit time
Failed to load latest commit information.
R import utils May 18, 2017
man roxygen2 6.0 Feb 7, 2017
vignettes -> Nov 14, 2019
.Rbuildignore use travis for this repo Sep 11, 2014
.gitignore start an RStudio project Sep 8, 2014
.travis.yml -> and redirect (#39) Nov 18, 2019
DESCRIPTION -> Nov 14, 2019
NAMESPACE import utils May 18, 2017
NEWS a NEWS file Sep 9, 2014 -> Nov 14, 2019
printr.Rproj update project options Jan 2, 2016


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 vignette('knit_print', package = 'knitr').

You can install the stable version from CRAN or the development version from my personal repo:

# CRAN version

# or the dev version
  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.

You can’t perform that action at this time.