[box type="note" align="" class="" width=""]This article is extracted from the book Machine Learning with R written by Brett Lantz. This…