Create files, which are then automatically removed afterwards.
with_file(file, code)local_file(file, .local_envir = parent.frame())
local_file(file, .local_envir = parent.frame())
[named list] Files to create.
[named list]
[any] Code to execute in the temporary environment
[any]
[environment] The environment to use for scoping.
[environment]
[any] The results of the evaluation of the code argument.
code
withr for examples
withr
# NOT RUN { with_file("file1", { writeLines("foo", "file1") readLines("file1") }) with_file(list("file1" = writeLines("foo", "file1")), { readLines("file1") }) # }
Run the code above in your browser using DataCamp Workspace