Showing posts with label End User Computing. Show all posts
Showing posts with label End User Computing. Show all posts

Create an R package from a single R file with roxyPackage

Documenting code can be a bit of a pain. Yet, the older (and wiser?) I get, the more I realise how important it is. When I was younger I said 'documentation is for people without talent'. Well, I am clearly loosing my talent, as I sometimes struggle to understand what I programmed years ago. Thus, anything that soothes the pain of writing and maintaining documentation must be good and should help me to better understand my 'old me' in the future.

Ideally I want my R code and documentation in as few files as possible. A good start to achieve this is using roxygen2, an R package which has been around for some time. It allows me to tie R code together with the documentation in the same file and helps considerably in maintaining R packages.

The roxyPackage by Meik Michalke goes a step further, building on roxygen2. Meik presented his package at the Cologne R user group meeting a few weeks ago and I was intrigued by it. As I said in my notes to the meeting, with roxyPackage I can create a package from a single file of R code and documentation.

Here is an example of one R file to build a package using roxyPackage. For my toy example I wrote a doughnut plot function in R, something which is clearly missing ;)


I took the basic pie chart function and amended it to plot another white disc in the middle. On top of the function code I wrote the help file documentation using the roxygen2 syntax.
Read more »

End User Computing and why R can help meeting Solvency II

John D. Cook gave a great talk about 'Why and how people use R'. The talk resonated with me and highlighted why R is such a great tool for end user computing. A topic which has become increasingly important in the European insurance industry.

John's main point on why people use R is that R gets the job done and I think he is spot on. Of course that's the trouble with R sometimes as well, or to quote Bo again:

"The best thing about R is that it was developed by statisticians.
"The worst thing about R is that it was developed by statisticians."
Bo Cowgill, Google

Read more »