Description Usage Arguments Value Examples
This function is a simple utility for checking whether a file exists and
should be overwritten. It is used internally with the file_new_*
family of
functions.
1 | overwrite_file(.path)
|
.path |
The path where an action is to be executed. |
LOGICAL; TRUE if the file does not exist and should be "overwritten" or TRUE if the user indicates they want to overwrite the file. FALSE if the user indicates they don't want to overwrite the file.
1 2 3 4 5 6 7 | if (interactive()) {
fs::dir_create("test-folder")
fs::file_create("test-folder/test-file.R")
if (overwrite_file("test-folder/test-file.R")) {
fs::file_create("test-folder/test-file.R")
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.