Code presented @ R meetup of June 16th 2014