Skip to content

Constructs a theme from step objects. NULL arguments are silently dropped, enabling conditional steps via if (cond) step(...).

Usage

new_theme(...)

Arguments

...

Step objects (step_file(), step_text(), step_run()).

Value

A list with class "prefab_theme" containing a steps element.

Composing themes with +

Themes compose with +, which concatenates their steps with the left operand's steps first. Either operand may be a path to a directory of template files, coerced with theme_from_dir() using its defaults:

r_analysis() + claude_r_analysis()
r_analysis() + "~/my-extras"
"~/my-baseline" + r_analysis()

Steps cannot be added to a theme directly; wrap them in new_theme() first. Anything that is neither a theme nor a path to an existing directory is an error.

One limitation: an fs::path() value does not work as a + operand in either position, because fs defines its own + method and R refuses to choose between the two. Wrap it in theme_from_dir() instead. A plain character path, and fs::path() values at use_theme(), create_project(), and launch_project(), are all fine.

See also

theme_from_dir() for how a template directory is read.