R code written for UCSC Machine Learning class