Introduction

We have two meta-information above:

A third field could be there too: date. For details, please check out Pandoc's homepage or just use pandoc.title function of this package.

As you can see writing and formatting paragraphs cannot be easier :)

But what about R? Let us return pi: 3.142

R objects

Pander.brew would transform any returned R object to Pandoc's markdown in each code block.

For example mtcars's first 5 cases look like:

Table continues below
  mpg cyl disp hp drat wt qsec vs am
Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1
Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1
Datsun 710 22.8 4 108 93 3.85 2.32 18.61 1 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0
Hornet Sportabout 18.7 8 360 175 3.15 3.44 17.02 0 0
  gear carb
Mazda RX4 4 4
Mazda RX4 Wag 4 4
Datsun 710 4 1
Hornet 4 Drive 3 1
Hornet Sportabout 3 2

As you can see some formatting was added to the returned table and was also split up as the original table would have been too wide to fit on the screen (any panderer still using a VT100 terminal?) or standard paper. If you do not like that split up, just set the according panderOption!

We could try other R objects too, for example let us check chisq.test on some variables of mtcars:

Pearson's Chi-squared test: mtcars$am and mtcars$gear
Test statistic df P value
20.94 2 2.831e-05 * * *

WARNING1

And we got a warning above!

Returning plot

Plots are automatically grabbed between brew tags and some custom formatting applied (if evalsOptions('graph.unify') is set to TRUE):

The above lattice looks (IMHO) pretty cool, but what about using base plot?

WARNING2

This should be quite similar by my intention :)

What about ggplot2?

And adding a caption is easy with even some modified panderOptions:

This is a caption, right?

This is a caption, right?

Captions

Just like with tables:

Here goes the first two lines of USArrests
  Murder Assault UrbanPop Rape
Alabama 13.2 236 58 21.2
Alaska 10 263 48 44.5

Multiple results

And the chunks can result in multiple R objects of course:

It happens

ERROR3


  1. Chi-squared approximation may be incorrect

  2. Applying default formatting to image is somehow compromised (the result could differ from what you specified in panderOptions). Hints: printing lattice/ggplot2 is not needed and tweaking base plots with par might have some side-effects!

  3. object 'unknown.R.object' not found

Design: Rapporter Team © 2011-2014 | Backend: pander | License: AGPL3 or OSL | Styled with skeleton