[Stable]

NONMEM produces a lot of temporary files which can add up to a lot of disk space. One strategy to remove this is to use the clean option in the PsN command. However, this can automatically remove files as soon as the run finishes that may be useful for debugging. ls_tempfiles() allows you to list the paths of all temporary files, for a single run or for all runs for inspection and deletion. clean_tempfiles() is a wrapper function that runs ls_tempfiles() and deletes everything returned. For safety is limited to only deleting files associated with nm objects though.

ls_tempfiles(
  object = ".",
  output_loc = c("run_dir", "base"),
  run_files = NA_character_,
  include_slurm_files = TRUE,
  ctl_extension = "mod",
  include_psn_exports = FALSE
)

clean_run(m, output_loc = c("run_dir", "base"), include_slurm_files = TRUE)

clean_tempfiles(
  object = ".",
  output_loc = c("run_dir", "base"),
  include_slurm_files = TRUE
)

Arguments

object

Either an nm object or path to project (default = "."). If a path is specified, the function will look for all runs in the directory (including subdirectories).

output_loc

Optional character for locating files. Either "run_dir" (default) for PsN execution or "base" for "nmfe" execution.

run_files

Optional character vector. Search amongst only these files instead. Default value NA searches based on object.

include_slurm_files

Logical (default = TRUE). Include files generated by Slurm.

ctl_extension

Character. Extension of control file (default = "mod")

include_psn_exports

Logical (default = FALSE). Considers files that PsN exports to the run_in directory as temporary

m

An nm object

Value

A character vector of temporary file paths

Details

Setting include_psn_exports = TRUE will break 'Pirana' and 'xpose' capability as these software use exported files.

Examples


# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1",
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))

ls_tempfiles(m1) ## if no files, will be empty
#> character(0)

m1 %>%
  ls_tempfiles() %>%
  unlink() ## delete all m1 temp files

## above line is equivalent to:
clean_tempfiles(m1)

ls_tempfiles() ## display all temp files in analysis project
#> character(0)

ls_tempfiles() %>% unlink() ## remove all temp files in analysis project