What’s a good approach to teaching R in a computer lab?

There have been several good questions and sets of answers on introductory books or approaches to learning R eg here and here. But I have a slightly different problem – the best way to run an hour long session (or several such sessions) in a computer lab that will get people started in R, familiar with its basic approach etc.

My current plan would be to effectively work through the introductory chapter/s of something like Verzani’s SimpleR and then introduce a familiar dataset, but is there any other approach that people have found useful? For example, is it good to introduce real data straight away, or address issues in more abstract way? Should I exhaustively go through how to use the square brackets, or excite people with examples of lattice graphics?

My target audience are familiar with statistics (although not experts) and competent SPSS users; not familiar with programming languages beyond the sort of macro and scripting you’d get in SPSS and similar things.

Any tips or references to lessons plans would be appreciated. However, I don’t want to duplicate the many good lists of on-line material introducing R – strictly references to the face to face instructional question.


I’d argue for a completely different approach. I’ve seen R tutorials that were taught from two different perspectives: a building-blocks approach, in which users are introduced to R’s fundamental concepts, and a shock-and-awe approach, in which users are shown R’s amazing capabilities but left with relatively little understanding of how to do anything. The latter definitely resonates more strongly with the pupils, but neither one seems very effective at actually producing users.

Instead, I would take a common and relatively simple task in SPSS and walk through converting it to R, with a little bit of feigned naivete on your part – e.g., following Xi’an’s excellent suggestion to look up some desired functions with ?? rather than just recalling the right function from memory. Your newbies will almost certainly be converting existing processes as they learn R, not writing them from scratch – so why not show them exactly how you’d go about that?

A good example could consist of just loading data, performing some descriptives, and popping out some basic plots. lm() can be very, very simple and produces results they’ll understand and can compare to SPSS output, so that might also good to cover.

For homework, get them to take a stab at converting one of their simple processes or loading and exploring a dataset with which they’re very familiar. Give them some one-on-one time to figure out where things are going wrong, then cover those in the next session with more example conversions. Concepts from your list will inevitably come up (my bet: factors vs. character vectors, for vs. apply) – and then you’ll have a real-world motivation for covering them. If they don’t come up (attach), then they’re not really needed yet – if that means your newbies write a little non-idiomatic code early on (for instead of apply), I don’t see the harm.

This way, your students can progress in much the same way foreign-language students do (or at least, the way I did): crude translation of simple expressions prompts the desire for more complex expressions, which causes desire for a deeper understanding of grammar, which eventually leads to idiomatic expression. Don’t jump to “grammar” too soon, and don’t worry too much about teaching them things they aren’t asking about because they’ll probably just forget it anyway. Gentle pointers about idiomatic expression are great (for vs apply), but the main thing is to get them generating output and exploring on their own.

Source : Link , Question Author : Community , Answer Author :
Matt Parker

Leave a Comment