added visualizations and code

You seem to be comfortable with ddply, though this is the kind of thing that the dplyr package makes easier (and more readable).