R/temp_dir.R

Defines functions temp_dir

Documented in temp_dir

#' Create a new temp dir
#' @export
temp_dir <- function() {
  time <- as.character(Sys.time())
  time <- gsub("[\\: ]", "-", time)
  rand <- as.character(stats::runif(1))
  rand <- gsub("[\\. ]", "", rand)
  dir.create(t <- file.path(
    tempdir(),
    sprintf(
      "%s-%s-%s",
      time,
      Sys.getpid(),
      rand
    )
  ))

  return(t)
}
raubreywhite/fhi documentation built on Jan. 5, 2020, 2:54 p.m.