1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/temp.R
\name{file_temp}
\alias{file_temp}
\alias{file_temp_push}
\alias{file_temp_pop}
\alias{path_temp}
\title{Create names for temporary files}
\usage{
file_temp(pattern = "file", tmp_dir = tempdir(), ext = "")
file_temp_push(path)
file_temp_pop()
path_temp(...)
}
\arguments{
\item{pattern}{A character vector with the non-random portion of the name.}
\item{tmp_dir}{The directory the file will be created in.}
\item{ext}{The file extension of the temporary file.}
\item{path}{A character vector of one or more paths.}
\item{...}{Additional paths appended to the temporary directory by \code{path()}.}
}
\description{
\code{file_temp()} returns the name which can be used as a temporary file.
}
\details{
\code{file_temp_push()} can be used to supply deterministic entries in the
temporary file stack. This can be useful for reproducibility in like example
documentation and vignettes.
\code{file_temp_pop()} can be used to explicitly remove an entry from the
internal stack, however generally this is done instead by calling
\code{file_temp()}.
\code{path_temp()} constructs a path within the session temporary directory.
}
\examples{
\dontshow{file_temp_push("/tmp/filedd461c46df20")}
path_temp()
path_temp("does-not-exist")
file_temp()
file_temp(ext = "png")
file_temp("image", ext = "png")
# You can make the temp file paths deterministic
file_temp_push(letters)
file_temp()
file_temp()
# Or explicitly remove values
while (!is.null(file_temp_pop())) next
file_temp_pop()
}
|