Opens a file for editing in RStudio, if that is the active environment, or via utils::file.edit() otherwise. If the file does not exist, it is created. If the parent directory does not exist, it is also created.

edit_file(path, open = NULL)

Arguments

path

Path to target file.

open

If, NULL, the default, will open the file when in an interactive environment that is not running tests. Use TRUE or FALSE to override the default.

Value

Target path, invisibly.

Examples

if (FALSE) { edit_file("DESCRIPTION") edit_file("~/.gitconfig") }