add_module: Create a module

Description Usage Arguments Value Note See Also

View source: R/add_modules.R

Description

This function creates a module inside the R/ folder, based on a specific module structure. This function can be used outside of a {golem} project.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
add_module(
  name,
  pkg = get_golem_wd(),
  open = TRUE,
  dir_create = TRUE,
  fct = NULL,
  utils = NULL,
  js = NULL,
  js_handler = NULL,
  export = FALSE,
  module_template = golem::module_template,
  ...
)

Arguments

name

The name of the module.

pkg

Path to the root of the package. Default is get_golem_wd().

open

Should the created file be opened?

dir_create

Creates the directory if it doesn't exist, default is TRUE.

fct

If specified, creates a mod_fct file.

utils

If specified, creates a mod_utils file.

js, js_handler

If specified, creates a module related JavaScript file.

export

Should the module be exported? Default is FALSE.

module_template

Function that serves as a module template.

...

Arguments to be passed to the module_template function.

Value

The path to the file, invisibly.

Note

This function will prefix the name argument with mod_.

See Also

module_template()


golem documentation built on April 17, 2021, 9:06 a.m.