Learn R Programming

usethis (version 3.0.0)

edit_file: Open file for editing

Description

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_template() specifically opens templates in inst/templates for use with use_template().

Usage

edit_file(path, open = rlang::is_interactive())

edit_template(template = NULL, open = rlang::is_interactive())

Value

Target path, invisibly.

Arguments

path

Path to target file.

open

Whether to open the file for interactive editing.

template

The target template file. If not specified, existing template files are offered for interactive selection.

Examples

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

Run the code above in your browser using DataLab