public
Created

  • Download Gist
knitr performance.r
R
1 2 3 4 5 6 7 8 9 10 11
## title:First Attempt at a knitr Performance Report
## author:Timely Portfolio
 
require(PerformanceAnalytics)
require(xtable)
 
data(edhec)
table.CalendarReturns(edhec[,1:3])[13:15]
charts.PerformanceSummary(edhec[,1:3],
colorset=c("gray50","steelblue2","steelblue4"),
main="EDHEC Performance by Type")
knitr stitch.r
R
1 2 3 4 5
require(knitr)
#use stitch to open and run the knitr performance.r script
# and then generate Rnw code
#knit2pdf converts the Rnw to a pdf
knit2pdf(stitch("knitr performance.r"))

Nice example. It seems

knit2pdf(stitch("knitr performance.r", output = NULL))

should be

stitch("knitr performance.r")

because stitch() will compile the tex output to PDF automatically. Besides, I do not recommend spaces in paths or filenames; sometimes they bring troubles when we call external programs like LaTeX.

I cannot thank you enough for your work on this. Thanks so much for such an incredibly powerful contribution to R. Please let me know if I can ever help with anything. Right now I just plan to add another set of examples to help publicize and document knitr.

Kent

On Apr 11, 2012, at 9:28 PM, Yihui Xiereply@reply.github.com wrote:

Nice example. It seems

knit2pdf(stitch("knitr performance.r", output = NULL))

should be

stitch("knitr performance.r")

because stitch() will compile the tex output to PDF automatically.


Reply to this email directly or view it on GitHub:
https://gist.github.com/2362469

you are welcome to play with the LaTeX part of knitr which should be mature enough now; once the markdown support becomes mature, I believe all R users should be able to play with dynamic report generation easily because no knowledge of LaTeX is required then -- it can be even simpler than Word.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.