mod_init {shinymgr}R Documentation

Creates an R script that contains a framework for developing a new module

Description

Creates an R script that contains a framework for developing a new module

Usage

mod_init(modName, author, shinyMgrPath)

Arguments

modName

The name of the module to be added to the modules table of the shinymgr.sqlite database. The function will write an R script as modName.R

author

A string with the author's name, formatted as "Lastname, Firstname".

shinyMgrPath

The path to the shinymgr project. Typically the working directory.

Value

Invisible. The function will write an R script with the name modName.R and store the file in the shinymgr project's modules folder.

More Info

The mod_init() function is described in the "shinymgr_modules" tutorial.

Tutorials

The shinymgr learnr tutorials include, in order:

  1. learnr::run_tutorial(name = "intro", package = "shinymgr")

  2. learnr::run_tutorial(name = "shiny", package = "shinymgr")

  3. learnr::run_tutorial(name = "modules", package = "shinymgr")

  4. learnr::run_tutorial(name = "app_modules", package = "shinymgr")

  5. learnr::run_tutorial(name = "tests", package = "shinymgr")

  6. learnr::run_tutorial(name = "shinymgr", package = "shinymgr")

  7. learnr::run_tutorial(name = "database", package = "shinymgr")

  8. learnr::run_tutorial(name = "shinymgr_modules", package = "shinymgr")

  9. learnr::run_tutorial(name = "apps", package = "shinymgr")

  10. learnr::run_tutorial(name = "analyses", package = "shinymgr")

  11. learnr::run_tutorial(name = "reports", package = "shinymgr")

  12. learnr::run_tutorial(name = "deployment", package = "shinymgr")

References

https://code.usgs.gov/vtcfwru/shinymgr

See Also

Other module: check_mod_info(), mod_header_parser(), mod_register()

Examples

## Only run this example in interactive R sessions
if (interactive()) {

# set the file path to the main shinymgr directory
parentPath <- tempdir()
shinyMgrPath <- paste0(parentPath, '/shinymgr')

shinymgr_setup(parentPath = parentPath, demo = FALSE)

mod_init(
  modName = "my_test_mod", 
  author = "Baggins, Bilbo", 
  shinyMgrPath = shinyMgrPath
)

# the file should be located in the shinymgr/modules directory
fp <- paste0(shinyMgrPath, "/modules/my_test_mod.R")

# determine if the file exists
file.exists(fp)

# show the file info
file.info(fp)

# show the file
file.show(fp)

# remove demo
unlink(shinyMgrPath, recursive = TRUE)

}


[Package shinymgr version 1.1.0 Index]