Temporarily create a tempfile, which is automatically removed afterwards.
with_tempfile(new, code, envir = parent.frame(), pattern = "file",
tmpdir = tempdir(), fileext = "")local_tempfile(new, envir = parent.frame(), pattern = "file",
tmpdir = tempdir(), fileext = "")
[character vector]
Names of temporary file handles to create.
[any]
Code to execute in the temporary environment
[environment]
Environment in which to define the temporary files.
a non-empty character vector giving the initial part of the name.
a non-empty character vector giving the directory name
a non-empty character vector giving the file extension
[any]
The results of the evaluation of the code
argument.
withr
for examples