From 303942f4a50dfefa148867ed49897d314dba294b Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Fri, 5 Jun 2020 20:23:09 -0400
Subject: [PATCH] Import "catn" function from previous assignment

---
 a4.r                    | 30 ++++++++++++++++++++++++++++++
 documents/references.md |  7 +++++++
 2 files changed, 37 insertions(+)

diff --git a/a4.r b/a4.r
index e69de29..a50a9d1 100644
--- a/a4.r
+++ b/a4.r
@@ -0,0 +1,30 @@
+###
+ # R code for assignment 4.
+ ##
+
+
+# Clear console.
+cat('\014')
+
+
+# Install and import packages.
+install.packages('rpart', dependencies=TRUE)
+install.packages('randomForest', dependencies=TRUE)
+library(rpart)
+library (randomForest)
+
+
+###
+ # The "cat" function seems to be an all around better alternative to "print".
+ # ("print" has a tendency to add extra, frivilous output that makes it look dirty and difficult to read.)
+ #
+ # This wrapper for "cat" then automatically adds a newline to the end of the message, effectively accomplishing
+ # what you would intuitively expect "print" to do.
+ #
+ # See references.md file for source of idea.
+ ##
+catn <- function(message, trailing='\n') {
+    cat(message)
+    cat(trailing)
+}
+
diff --git a/documents/references.md b/documents/references.md
index ad9ca4a..33b7392 100644
--- a/documents/references.md
+++ b/documents/references.md
@@ -3,3 +3,10 @@
 
 ## Description
 All references to external logic. Includes anything from stack overflow links to notes about logic from previous works.
+
+
+## R
+
+### Alternative to the "Print" Function
+Because it doesn't always behave how I expect, and tends to give additional, "dirty" output that I don't want.
+<https://stackoverflow.com/questions/11230957/alternative-to-print-and-cat>
-- 
GitLab