Skip to content

Instantly share code, notes, and snippets.

@daroczig
Last active December 15, 2015 09:29
Show Gist options
  • Save daroczig/5238455 to your computer and use it in GitHub Desktop.
Save daroczig/5238455 to your computer and use it in GitHub Desktop.
## load "pander" package
## http://rapporter.github.com/pander/
library(pander)
## "brew" the below file to Pandoc's markdown
Pandoc.brew('example.brew')
## or convert to HTML at one go
## NOTE: `pandoc` is needed for the conversion
Pandoc.brew('example.brew', output = tempfile(), convert = 'html')
## or pdf/docx/odt
Pandoc.brew('example.brew', output = tempfile(), convert = 'pdf')
Pandoc.brew('example.brew', output = tempfile(), convert = 'docx')
Pandoc.brew('example.brew', output = tempfile(), convert = 'odt')
# Doc header 1
Some text explaining the analysis we are doing
<%=
summary(cars)# a summary table
%>
Images should be in separate chunks not to be handles as inline image:
<%=
plot(cars) # a plot
%>
And a model at last:
<%=
fit <- lm(dist~speed, data = cars)
fit
%>
# Doc header 1
Some text explaining the analysis we are doing
----------------------------------
&nbsp; speed dist
------ ------------ --------------
**** Min. : 4.0 Min. : 2.00
**** 1st Qu.:12.0 1st Qu.: 26.00
**** Median :15.0 Median : 36.00
**** Mean :15.4 Mean : 42.98
**** 3rd Qu.:19.0 3rd Qu.: 56.00
**** Max. :25.0 Max. :120.00
----------------------------------
Images should be in separate chunks not to be handles as inline image:
![](/tmp/RtmpD3QXAs/plots/4304da6127c.png)
And a model at last:
--------------------------------------------------------------
&nbsp; Estimate Std. Error t value Pr(>|t|)
----------------- ---------- ------------ --------- ----------
**(Intercept)** -17.58 6.758 -2.601 0.01232
**speed** 3.932 0.4155 9.464 1.49e-12
--------------------------------------------------------------
Table: Fitting linear model: dist ~ speed
@eipi10
Copy link

eipi10 commented Mar 25, 2013

Works fine now. Thanks very much for creating and maintaining pander!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment