swcarpentry/bc — pull request #718 by jdblischak (2014-09-16 18:21:59+00:00)
Title: "Translation" of novice Python lesson on flow control to R

This is a "translation" of the novice Python lesson on flow control, called [Making Choices][lesson]. I put translation in quotes because it is largely re-written. The Python example focuses heavily on the `ipythonblocks` module. I did not think this was suitable for R for the following reasons:

* The port of `ipythonblocks` to R, [rblocks][], is still a work-in-progress. I did not think it would be suitable for novices to have to install `devtools` and then use `install_github` in order to install a package with an unstable API.
* Up to this point, all the lessons use only vectors and data frames. The heatmap example would require using a matrix. Introducing a matrix would require a more in-depth explanation of the different data structures, which I want to avoid just like the Python lessons do.
* When building the heatmap is the main example, a non-significant amount of the lesson material has to focus on explaining how colors are represented by computers, e.g. the Challenge question "Why do computers use red, green, and blue as their primary colors?"

[lesson]: http://software-carpentry.org/v5/novice/python/04-cond.html
[rblocks]: https://github.com/ramnathv/rblocks

So instead of building a heatmap with `ipythonblocks`, I chose to use saving plots to files as the motivation for flow control. Thus in the lesson we modify the functions that were written in the previous lessons to take an argument whether or not to save the plot to a PDF file.

Please let me know your thoughts, especially as to whether this is a good motivating example.

The Markdown file does not properly display on GitHub. To make it easier to quickly view the rendered version, I merged these changes into my gh-pages branch ([link][04]).

[04]: http://jdblischak.github.io/bc/novice/r/04-cond.html