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