Programming (useR! 2011)

August 17, 2011

(This article was first published on Why? » R, and kindly contributed to R-bloggers)

Ray Brownrigg – Tips and Tricks for young R programmers


Calculate the distribution function of a bivariate Kolomogorov Smirnoff statistic. Essentially three loops. Basic exhaustive search is O(N^3). Fortran gives a single order of magnitude speed-up. Restructuring in R using a single loop is an order faster than fortran. Further improvements make the algorithm 3 times faster.


  • Resolution of pdf graphs: specify width and height to suit eventual size.
  • Local versions of standard functions: compare rank(x) with .Internal(rank(x, "min")).  Ditto with sort
  • Vectorisation
  • Curve: handy for finding errors

F Schuster – Software design patterns in R

In Java software design patterns are everywhere. What about R?

What is a design pattern?

A generalised, reusable and time test-test solution. Every pattern has a description of its general principle. A collection of patterns are organised into catalogues. Reusing proven concepts helps productivity.

R design pattern

  • Factory method pattern. e.g. plotting program calls a function to get a symbol. The factor method makes the program independent of how the symbols are created.
  • A function closure maintains the object state. You can have private functions within a closure.
  • Map pattern – apply function in R
  • Filter -
  • compose concept and chain of responsibility

Patrick Burns – Random input testing with R

Good talk, just found it hard to make notes. A closely related topic is fuzzy testing.


Please note that the notes/talks section of this post is merely my notes on the presentation. I may have made mistakes: these notes are not guaranteed to be correct. Unless explicitly stated, they represent neither my opinions nor the opinions of my employers. Any errors you can assume to be mine and not the speaker’s. I’m happy to correct any errors you may spot – just let me know!

To leave a comment for the author, please follow the link and comment on his blog: Why? » R. offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.