Description Usage Arguments Value Examples
This function is a simple utility for checking whether a directory exists. It
is used internally with the file_new_*
family of functions.
1 | dir_exists_prompt(.path)
|
.path |
The path where an action is to be executed. |
LOGICAL; TRUE if the directory already exists or TRUE if the user indicates they want to create the directory (in which case it will be created in this function). FALSE if the directory does not exist and the user indicates they don't want to create it.
1 2 3 4 5 6 | if (interactive()) {
fs::dir_create("test-folder")
if (dir_exists_prompt(here("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.