Movatterモバイル変換


[0]ホーム

URL:


Skip to contents

Golem Module Template Function

Source:R/modules_fn.R
module_template.Rd

Module template can be used to extend golem module creationmechanism with your own template, so that you can be even moreproductive when building your{shiny} app.Module template functions do not aim at being called as is byusers, but to be passed as an argument to theadd_module()function.

Usage

module_template(name,path,export, ph_ui=" ", ph_server=" ",...)

Arguments

name

The name of the module.

path

The path to the R script where the module will be written.Note that this path will not be set by the user but viaadd_module().

export

Should the module be exported? Default isFALSE.

ph_ui, ph_server

Texts to insert inside the modules UI and server.For advanced use.

...

Arguments to be passed to themodule_template function.

Value

Used for side effect

Details

Module template functions are a way to define your own templatefunction for module. A template function that can take the followingarguments to be passed fromadd_module():

  • name: the name of the module

  • path: the path to the file in R/

  • export: a TRUE/FALSE set by theexport param ofadd_module()

If you want your function to ignore these parameters, set... as thelast argument of your function, then these will be ignored. See the examplessection of this help.

See also

add_module()

Examples

if(interactive()){my_tmpl<-function(name,path,...){# Define a template that write to the# module filewrite(name,path)}golem::add_module(name="custom", module_template=my_tmpl)my_other_tmpl<-function(name,path,...){# Copy and paste a file from somewherefile.copy(...,path)}golem::add_module(name="custom", module_template=my_other_tmpl)}

[8]ページ先頭

©2009-2025 Movatter.jp