tempfile {file} | R Documentation |
tempfile
returns a vector of character strings
which can be used as names for temporary files.
tempfile(
pattern = "file",
tmpdir = Call "tempdir"(),
fileext = ".tmp");
The length of the result is the maximum of the lengths of the three arguments; values of shorter arguments are recycled.
The names are very likely To be unique among calls To tempfile In an R session And across simultaneous R sessions (unless tmpdir Is specified). The filenames are guaranteed Not To be currently In use.
The file name Is made by concatenating the path given by tmpdir, the pattern String, a random String In hex And a suffix Of fileext.
By Default, tmpdir will be the directory given by tempdir(). This will be a subdirectory of the per-session temporary directory found by the following rule when the R session Is started. The environment variables TMPDIR, TMP And TEMP are checked in turn And the first found which points to a writable directory Is used: If none succeeds the value Of R_USER (see Rconsole) Is used. If the path To the directory contains a space In any Of the components, the path returned will use the shortnames version Of the path. Note that setting any Of these environment variables In the R session has no effect On tempdir(): the per-session temporary directory Is created before the interpreter Is started.
a character vector giving the names of possible (temporary) files. Note that no files are generated by tempfile.