Debian Codegraph @

man/with_file.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/file.R
3 \name{with_file}
4 \alias{with_file}
5 \alias{local_file}
6 \title{Files which delete themselves}
7 \usage{
8 with_file(file, code)
9
10 local_file(.file, ..., .local_envir = parent.frame())
11 }
12 \arguments{
13 \item{file, .file}{\verb{[named list]}\cr Files to create.}
14
15 \item{code}{\code{[any]}\cr Code to execute in the temporary environment}
16
17 \item{...}{Additional (possibly named) arguments of files to create.}
18
19 \item{.local_envir}{\verb{[environment]}\cr The environment to use for scoping.}
20 }
21 \value{
22 \code{[any]}\cr The results of the evaluation of the \code{code}
23 argument.
24 }
25 \description{
26 Create files, which are then automatically removed afterwards.
27 }
28 \examples{
29 with_file("file1", {
30 writeLines("foo", "file1")
31 readLines("file1")
32 })
33
34 with_file(list("file1" = writeLines("foo", "file1")), {
35 readLines("file1")
36 })
37 }
38 \seealso{
39 \code{\link{withr}} for examples
40 }