Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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())

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.

Value

Target path, invisibly.

Examples

## Not run: 
edit_file("DESCRIPTION")
edit_file("~/.gitconfig")

## End(Not run)

usethis

Automate Package and Project Setup

v2.0.1
MIT + file LICENSE
Authors
Hadley Wickham [aut] (<https://orcid.org/0000-0003-4757-117X>), Jennifer Bryan [aut, cre] (<https://orcid.org/0000-0002-6983-2759>), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.