diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-08-22 02:02:36 -0300 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-08-22 02:02:39 -0300 |
commit | efa744c5840e8ea7521aa0955956411dfe30120f (patch) | |
tree | a6933a5a19cf7d1bd53ac5aaa32a27a3df0ba1d0 /util.R | |
parent | aa2cea8660f904658e977c9d1088e740c78d79a4 (diff) |
Added util.R.
Diffstat (limited to 'util.R')
-rw-r--r-- | util.R | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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) + } +} |