R/create_template.R
create_template.Rd
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
)
character. Path to where the app should be created
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.
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.
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
character. Name of the author(s)
logical. Whether to include a leaflet map. Default TRUE
logical. Whether to include a table tab. Default TRUE
logical. Whether to include a tab for viewing module
code. Default TRUE
logical. Whether to install the package. Default FALSE
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
No return value, called for side effects
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)