Creates a skeleton app containing empty modules with options controlling objects in common and whether to include a map, code and tables

create_template(
  path,
  name,
  common_objects,
  modules,
  author,
  include_map = TRUE,
  include_table = TRUE,
  include_code = TRUE,
  install = FALSE,
  logger = NULL
)

Arguments

path

character. Path to where the app should be created

name

character. Name of the app which will be used as the package name. Must be only characters and numbers and not start with a number.

common_objects

character vector. Names of objects which will be shared between modules. The objects meta, logger and state are included by default and if include_map is TRUE, the object poly is included to store polygons drawn on the map.

modules

dataframe. Containing one row for each module in the order to be included and with the following column names:

  • component character. Single word descriptor for the component used to name files

  • long_component character. Full component name displayed to the user, formatted appropriately

  • module character. Single word descriptor for the module used to name files

  • long_module character. Full module name displayed to the user, formatted appropriately

  • map logical. Whether or not the module interacts with the map

  • result logical. Whether or not the module produces results

  • rmd logical. Whether or not the module is included in the markdown

  • save logical. Whether or not the input values of the model should be saved

  • async logical. Whether or not the module will run asynchronously

author

character. Name of the author(s)

include_map

logical. Whether to include a leaflet map. Default TRUE

include_table

logical. Whether to include a table tab. Default TRUE

include_code

logical. Whether to include a tab for viewing module code. Default TRUE

install

logical. Whether to install the package. Default FALSE

logger

Stores all notification messages to be displayed in the Log Window. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL

Value

No return value, called for side effects

Author

Simon E. H. Smart simon.smart@cantab.net

Examples

td <- tempfile()
dir.create(td, recursive = TRUE)

modules <- data.frame(
"component" = c("data", "data", "plot", "plot"),
"long_component" = c("Load data", "Load data", "Plot data", "Plot data"),
"module" = c("user", "database", "histogram", "scatter"),
"long_module" = c("Upload your own data", "Query a database to obtain data",
"Plot the data as a histogram", "Plot the data as a scatterplot"),
"map" = c(TRUE, TRUE, FALSE, FALSE),
"result" = c(FALSE, FALSE, TRUE, TRUE),
"rmd" = c(TRUE, TRUE, TRUE, TRUE),
"save" = c(TRUE, TRUE, TRUE, TRUE),
"async" = c(TRUE, FALSE, FALSE, FALSE))

common_objects = c("raster", "histogram", "scatter")

create_template(path = td, name = "demo",
common_objects = common_objects, modules = modules,
author = "Simon E. H. Smart", include_map = TRUE, include_table = TRUE,
include_code = TRUE, install = FALSE)