Last active
December 15, 2015 09:29
-
-
Save daroczig/5238455 to your computer and use it in GitHub Desktop.
"pander"-only version of http://www.r-statistics.com/2013/03/write-ms-word-document-using-r-with-as-little-overhead-as-possible/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Doc header 1 | |
Some text explaining the analysis we are doing | |
---------------------------------- | |
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: | |
-------------------------------------------------------------- | |
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 |
Yeah, that's pretty normal after all it seems, I am just curious why this problem did not occurred recently.
Anyway, IMHO it's fixed in the GitHub version. Could you please verify, @eipi10?
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
Thanks for the quick reply @daroczig. The weird directory is (AFAIK) a temporary (hidden) folder that OS-X creates in some download situations. I don't really know the details, but it does that in a wide range of situations, such as when installing an R package. For example, here's the output of a command I just ran in the R console:
I'm not sure why it works that way and I've never had a reason to try and find anything on those weird paths, but that's the way it seems to work.
eipi10