STYLE:  Used formatR to format the R code using the command tidy.dir( path = ".", recursive = FALSE, keep.comment = TRUE, keep.blank.line = TRUE, replace.assign = TRUE, left.brace.newline = FALSE, reindent.spaces = 2 )