Tuesday, February 12, 2013

Another Experiment with R and Sweave

The R package PApages is a great start towards addressing the very common problem of internal and external reporting in the money management industry.  Advent's APX, Axys, and Black Diamond and the up and coming extremely well-connected and well-funded Addepar provide basic and acceptable reporting but generally don’t provide the full set of risk and return metrics that I would expect.  Since the very successful GSOC projects with PerformanceAnalytics …Now With More Bacon (2008)! and New Attribution Functions for PortfolioAnalytics, we have a comprehensive and robust set of risk, return, and attribution measures in R.  Combined with the near limitless graphical abilities of R with xtsExtra, ggplot, lattice, and base graphics, R seems to offer one of the best platforms for reporting, so I’ve committed myself to continue my series http://timelyportfolio.blogspot.com/search/label/reporting exploring various reporting options in R.

This is a fairly crude sketch of something we can accomplish easily with R, Sweave, and PerformanceAnalytics.  I hope to itergreat to something a little more compelling.  If the embedded pdf does not work below, please see at https://www.box.com/s/xpfn3rjwwmv8aftmkbyi.

R Sweave file from GIST:

1 comment:

  1. Thanks for posting this. I'm learning R and it is very helpful to have code like this.

    Here is what I did to get it to run (with date appended as bonus):

    onepagereportsetup <- system.file("Sweave", "onepager_text_graphics.Rnw", package = "utils")
    onepagereportdated <- paste0("onepager_text_graphics_",format(Sys.time(),"%Y%m%d"),".tex")
    # onepagereportdated <- paste0("onepager_text_graphics_",format(Sys.time(),"%Y%m%d%s"),".tex")
    Sweave(onepagereportsetup,output=onepagereportdated)
    tools::texi2pdf(onepagereportdated)

    In addition, I had to change \Huge to \huge

    P.S. Have you tried knitr? It seems to be an upgrade on Sweave that is highly recommended here and there. I haven't tried it myself.

    ReplyDelete