[This article was first published on Taiyun Wei, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The code was shared on my google docs. See it here.
To leave a comment for the author, please follow the link and comment on their blog: Taiyun Wei.