aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-08-22 02:02:36 -0300
committerSamuel Fadel <samuelfadel@gmail.com>2016-08-22 02:02:39 -0300
commitefa744c5840e8ea7521aa0955956411dfe30120f (patch)
treea6933a5a19cf7d1bd53ac5aaa32a27a3df0ba1d0
parentaa2cea8660f904658e977c9d1088e740c78d79a4 (diff)
Added util.R.
-rw-r--r--run.R13
-rw-r--r--util.R15
2 files changed, 16 insertions, 12 deletions
diff --git a/run.R b/run.R
index 3f5d3fa..9f4bbbc 100644
--- a/run.R
+++ b/run.R
@@ -8,6 +8,7 @@ require(mp)
require(Rtsne)
source("measures.R")
+source("util.R")
# Performs automated silhouette improvement manipulation, using a method
# inspired by Schaefer et al. (2013).
@@ -76,18 +77,6 @@ scale.Ys <- function(Ys) {
Ys
}
-# Creates a directory at given path, optionally logging the action.
-# If it already exists, the directory is not created.
-dir.create.safe <- function(path, log=T) {
- if (!dir.exists(path)) {
- if (log) {
- loginfo("Creating directory: %s", path)
- }
-
- dir.create(path)
- }
-}
-
# Generates samples (one sample per iteration) and performs automated
# manipulation for all measures on each sample.
run.manipulation <- function(X, Dx, labels, k, ds, n.iter, output.dir) {
diff --git a/util.R b/util.R
new file mode 100644
index 0000000..0a87079
--- /dev/null
+++ b/util.R
@@ -0,0 +1,15 @@
+# util.R
+#
+# Assorted utilities.
+
+# Creates a directory at given path, optionally logging the action.
+# If it already exists, the directory is not created.
+dir.create.safe <- function(path, log=T) {
+ if (!dir.exists(path)) {
+ if (log) {
+ loginfo("Creating directory: %s", path)
+ }
+
+ dir.create(path)
+ }
+}