make_script: Create an R Script from Stub Template

View source: R/make_script.R

make_scriptR Documentation

Create an R Script from Stub Template

Description

Convenience wrapper for make_notebook() that creates R scripts (.R files). This is identical to calling make_notebook("name.R").

Usage

make_script(name, dir = NULL, stub = "default", overwrite = FALSE)

Arguments

name

Character. The script name (with or without .R extension). Examples: "process-data", "process-data.R"

dir

Character. Directory to create the script in. Uses your project's configured directories$scripts setting. Default: "scripts/".

stub

Character. Name of the stub template to use. Defaults to "default". User can create custom stubs in ⁠stubs/script-{stub}.R⁠.

overwrite

Logical. Whether to overwrite existing file. Default FALSE.

Details

This function is a convenience wrapper that:

  1. Ensures the name ends with .R extension

  2. Uses script_dir config option instead of notebook_dir

  3. Calls make_notebook() with type = "script"

Default Output

Scripts are created in the ⁠scripts/⁠ directory by default:

scripts/
  process-data.R
  build-features.R
  run-model.R

Value

Invisible path to created script

See Also

make_notebook() for creating Quarto/RMarkdown notebooks

Examples


if (FALSE) {
# Create script (extension optional)
make_script("process-data")
make_script("process-data.R")

# Use custom stub
make_script("etl-pipeline", stub = "etl")

# Create in specific directory
make_script("analysis", dir = "analysis/")
}



framework documentation built on Feb. 18, 2026, 1:07 a.m.