Learn R Programming

shinyscholar (version 0.2.5)

save_and_load: Adds lines to modules to save and load input values.

Description

Converts 'shiny' *Input functions to lines of code required to store and reload the values when the app is saved or loaded. By default all the modules in the application are edited. Currently only input functions from 'shiny' and shinyWidgets::materialSwitch are supported.

Usage

save_and_load(folder_path, module = NULL)

Value

No return value, called for side effects

Arguments

folder_path

character. Path to the parent directory containing the application

module

character. (optional) Name of a single module to edit

Author

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

Examples

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

modules <- data.frame(
  "component" = c("demo"),
  "long_component" = c("demo"),
  "module" = c("demo"),
  "long_module" = c("demo"),
  "map" = c(FALSE),
  "result" = c(TRUE),
  "rmd" = c(TRUE),
  "save" = c(TRUE),
  "async" = c(FALSE))

create_template(path = td, name = "demo",
                common_objects = c("demo"), modules = modules,
                author = "demo", include_map = FALSE,
                include_table = FALSE, include_code = FALSE, install = FALSE)

test_files <- list.files(
  system.file("extdata", package = "shinyscholar"),
  pattern = "test_test*", full.names = TRUE)

module_directory <- file.path(td, "demo", "inst", "shiny", "modules")
file.copy(test_files, module_directory, overwrite = TRUE)

save_and_load(file.path(td, "demo"), module = "test_test")

Run the code above in your browser using DataLab