R/create_jobdirs.R

Defines functions create_jobdirs

create_jobdirs <- function(shared_directory, jobtype) {
  if (jobtype == "BOOTSTRAP") {
    jobShort <- "BOOT"
  } else if (jobtype == "ESTIMATION_RUN") {
    jobShort <- "EST"
  } else if (jobtype == "STEPWISE_SEARCH") {
    jobShort <- "STEP"
  } else if (jobtype == "COVAR_SEARCH") {
    jobShort <- "SHOT"
  } else if (jobtype == "PROFILE_RUN") {
    jobShort <- "PROF"
  } else if (jobtype == "GENERIC") {
    jobShort <- "GEN"
  } else {
    jobShort <- jobtype
  }

  jobHome <-
    file.path(
      shared_directory,
      paste0(jobShort, format(Sys.time(), "%y%m%d%H%M%OS2"))
    )
  assign("jobHome", gsub("\\", "/", jobHome, fixed = TRUE),
    envir = nlmeEnv
  )
  listWDs <- list.dirs(jobHome, recursive = FALSE, full.names = FALSE)
  if (length(listWDs) > 0) {
    SharedWorkingDir <- file.path(
      jobHome,
      paste0("Shared_", length(listWDs))
    )
  } else {
    SharedWorkingDir <- file.path(
      jobHome,
      "Shared"
    )
  }

  SharedWorkingDir <- normalizePath(SharedWorkingDir, winslash = "/", mustWork = FALSE)
  assign("SharedWorkingDir", SharedWorkingDir, envir = nlmeEnv)
  all(dir.create(SharedWorkingDir, showWarnings = FALSE, recursive = TRUE))
}

Try the Certara.NLME8 package in your browser

Any scripts or data that you put into this service are public.

Certara.NLME8 documentation built on Oct. 16, 2024, 1:09 a.m.