use_example: Create or edit an example .R file

View source: R/use_example.R

use_exampleR Documentation

Create or edit an example .R file

Description

Creates an R script in man/examples to store examples for a function.

Usage

use_example(name = NULL, dir = "man/examples", open = rlang::is_interactive())

Arguments

name

Either a name without extension, or NULL to create the paired file based on currently open file in the script editor. If the ⁠R/⁠ or test file is open, use_example() will create/open the corresponding example file.

dir

The directory where example scripts will be stored. Defaults to man/examples.

open

Whether to open the file for interactive editing.

Value

If an example file does not already exist, creates an example file. If open is TRUE, opens the example file.

See Also

usethis::use_r() and usethis::use_test()


rossellhayes/arhfn documentation built on Aug. 7, 2023, 8:03 a.m.