mercoledì 3 aprile 2013

lunedì 3 dicembre 2012

Italian Bio R Day 2012 - Slides on Reproducible Research using R and Bioconductor

Thanks to Parco Tecnologico Padano (PTP), I was invited to speak at the first Italian Bio R Day that was held in Lodi on 30 November 2012. It was a nice opportunity to talk and listen about different aspects of R from practitioners with different backgrounds (epidemiology, chemometrics and bioinformatics).
My presentation was about Reproducible Research in High-Throughput Biology using R and Bioconductor. The presentation was held in Italian but the slides and the case study are in English. All the material was created using Rstudio, taking advantage of its amazing integration with both  knitr and github,  knitr to convert R Markdown to Markdown and Sweave/knitr to LaTeX, and pandoc for converting markdown to html5. The material is quite basic, nevertheless I'd like to share it under the Creative Commons Attribution-NonCommercial-Share Alike 3.0 License. You can access everything from here. Fell free to fork it, highlight errors or plagiarism, suggest modifications, etc.:  I'll be more than happy to fix bugs and give credits to where is due.
 Finally, I'd like to thank Andrea Pedretti for inviting me at this nice meeting , Yihui Xie for his awesome knitr package and Vince Buffalo for his inspiring The Beauty of Bioconductor blog post.

lunedì 5 dicembre 2011

The Art of R Programming - my two cents

What makes this book different from other books about R is stated clearly by the author Norman Matloff in the introduction:
"This book is not a compendium of the myriad types of statistical methods that are available in the wonderful R package. It really is about programming and cover programming-related topics missing from most other books on R".
Most books about R present a gentle introduction to the language and then jump to practical applications. Norman Matloff, across the 350 pages of this book, accompanies the reader in developing the necessary skills useful to write software in a proper way focusing on the characteristics and idiosyncrasies of the R language.

In each of the first six chapters of the book the author covers a different R data type: vector, matrix, list, data.frame and factor.   Starting from basic examples and progressing to more complex ones each data type is properly introduced and used in the proper context. Furthermore,  some extended examples are ameliorated or re-implemented along new type are introduced in order to show the expressivity of the language. The explanation of small details such as the use of the drop=FALSE argument in matrix/data.frame subsetting or the stringsAsFactor=FALSE argument when building up a data.frame are the proverbial icing on the cake which can make your day-by-day workflow more productive.
Chapter 7, 8 and 9 are the heart of the Art of R Programming introducing the structures, idioms, peculiarities and idiosyncrasies of R as programming language.
Chapter 7 presents how the typical programming structures are implemented in R and how to use them correctly: control statements, functions, recursion etc. are explained by clear and appropriate examples of increased complexity and usefulness.
Chapter 8 about doing math and simulation in R is a more 'traditional' chapter depicting the mathematical/statistical facilities embedded in R. Since the main selling-point of R is its statistical capabilities an introduction to their characteristics and use makes perfectly sense.
Chapter 9 covers S3 and S4 the two most commonly used paradigms of object-oriented programming (OOR) implemented in R. If you are going to start designing and developing R software in a proper and reusable form this chapter will provide all the necessary information and a good collection of examples tailored to R mathematical/statistical peculiarities.
Chapter 10 is about I/O and provides all the necessary directions needed to parse data in R locally and from the internet.
Chapter 11 is about string manipulation and it is less technical than former chapters, presenting a sort of cheat-sheet collection of the most common functions to handle string in R. The author covers the  string capabilities embedded in base R but advices to take a look at Hadley Wickham's stringr package for a more consistent handling of strings in R.
Chapter 12 introduces graphics in R providing a gentle overview of the huge R graphics capabilities but it doesn't present an in-depth discussion. Fortunately there are a lot of other books (for example Paul Murrel's R Graphics) dedicated to this subject which is indeed one of the R's strong points.
Chapter 13 about debugging is short but points out almost everything is important to know about debugging R code; furthermore it provides a wide vision about debugging in general: the author Norman Matloff is also the co-author of The Art of Debugging with GDB and DDD and clearly he knows the matter of which he speaks.
Chapter 14 covers strategies to handle the time/space trade-off in order to enhance the performance of R programs. In particular it explains the proper use of vectorization in order to speed up your code.
Chapter 15 and 16 are a sort of follow-up to chapter 14, meaning that they explain how to enhance the performance of your code by integrating R with other language, such as Python and C/C++ (Chapter 15) and by parallelizing your code. Both chapters provide an introductory glance on these topics but present sufficient coverage in order to be useful.
Conclusions:
Is it worth to buy this book? The short answer is YES. If you are serious in learning R in order to both analyze in the most appropriate and effective way your data (e.g. using the appropriate data type according your specific task) and to develop software, The Art of R programming will be beneficial to you.
Caveats: since the peculiar approach and aim of this book my advice is to buy this book together with a more statistical oriented, for example Rob Kabacoff's R in Action and one or two about graphics in R (e.g. Hrishi Mittal's R Graph Cookbook or Hadley Wickham's ggplot2 book).

Disclaimer: No Starch Press provided me a free copy for review.