Creates a file name given a prefix and other optional paramters for a figure or data file. Also checks if file exists.

makeFigName(prefix, ext = "pdf", prefix0 = "Fig", date = TRUE,
  path = ".")

makeDatName(prefix, ext = "rda", prefix0 = "Dat", date = TRUE,
  path = ".")

Arguments

prefix
A file specific prefix.
ext
The extension; default is pdf for a figure and rda for a data file.
prefix0
The general prefix for figures. Default is Fig for a figure and Dat for a data file.
date
Should the data (as reported by date) be used as part of the file name? Default is TRUE.
path
The path to the file. Default is ".".

Value

A character with the figure file name.

Details

TODO: If file exists, create the next increment.

Examples

makeFigName("foo")
#> [1] "./Fig-foo-Tue-Jan-10-17:33:03-2017.pdf"
makeFigName("foo", date = FALSE)
#> [1] "./Fig-foo.pdf"
makeDatName("foo", date = FALSE)
#> [1] "./Dat-foo.rda"
makeFigName("foo", path = "~/projects/big-project/figs")
#> [1] "~/projects/big-project/figs/Fig-foo-Tue-Jan-10-17:33:03-2017.pdf"
makeDatName("foo", path = "~/projects/big-project/Data")
#> [1] "~/projects/big-project/Data/Dat-foo-Tue-Jan-10-17:33:03-2017.rda"