http://wiki.stdout.org/rcookbook/