FG_fetch_state {formods} | R Documentation |
Fetch Figure Generation State
Description
Merges default app options with the changes made in the UI
Usage
FG_fetch_state(
id,
input,
session,
FM_yaml_file,
MOD_yaml_file,
id_ASM = NULL,
id_UD = NULL,
id_DW = NULL,
react_state
)
Arguments
id |
Shiny module ID |
input |
Shiny input variable |
session |
Shiny session variable |
FM_yaml_file |
App configuration file with FM as main section. |
MOD_yaml_file |
Module configuration file with MC as main section. |
id_ASM |
ID string for the app state management module used to save and load app states |
id_UD |
ID string for the upload data module used to handle uploads or the name of the list element in react_state where the data set is stored. |
id_DW |
ID string for the data wrangling module to process any uploaded data |
react_state |
Variable passed to server to allow reaction outside of module ( |
Value
list containing the current state of the app including default values from the yaml file as well as any changes made by the user. The structure of the list is defined below:
yaml: Contents of the yaml file.
MC: Module components of the yaml file.
FG: Data wrangling state
isgood: Boolean status of the state. Currently just TRUE
button_counters: List of counters to detect button clicks.
ui_msg: Message returned when users perform actions.
ui: Current value of form elements in the UI.
ui_ids: Vector of UI elements for the module.
ui_hold: List of hold elements to disable updates before a full ui referesh is complete.
checksum: checksum of the FG module used to detect changes in the module.
aes_elements: Plot elements defined by aesthetics (i.e. the X in geom_X)
current_fig: fig_id of the currently figure.
fig_cntr: Counter for figures, incremented each time a new figure is created.
DSV: Available data sets from the UD and DW modules.
figs: List of figures. Each view has the following structure:
add_isgood: JMH
checksum: Checksum of the figure used to detect changes in the figure.
code: Code to generate figure from start to finish.
code_fg_only: Code to just generate the figure.
code_previous: Code to load and/or wrangle the dataset.
elements_table: Table of figure generation elements.
fg_object_name: JMH
fig_dsview: Name of the dataset view for the current figure (also the R object name of the dataset view).
fobj: JMH
id: Character id (
fig_idx
)idx: Numeric id (
1
)isgood: Boolean status of the figure. FALSE if evaluation/build fails.
key: Figure key acts as a title/caption (user editable)
msgs: JMH
notes: Figure notes (user editable)
num_pages: JMH
page: JMH
MOD_TYPE: Character data containing the type of module
"DW"
id: Character data containing the module id module in the session variable.
FM_yaml_file: App configuration file with FM as main section.
MOD_yaml_file: Module configuration file with MC as main section.
Examples
# Configuration files
FM_yaml_file = system.file(package = "formods", "templates", "formods.yaml")
MOD_yaml_file = system.file(package = "formods", "templates", "FG.yaml")
# We need to specify both the FG module id as well as the
# id of the UD module that feeds into it.
id = "FG"
id_UD = "UD"
id_DW = "DW"
# These would be the Shiny input and session variables
input = list()
session = list()
# Creating an empty state object
state = FG_fetch_state(id = id,
input = input,
session = session,
FM_yaml_file = FM_yaml_file,
MOD_yaml_file = MOD_yaml_file,
id_UD = id_UD,
id_DW = id_DW,
react_state = NULL)
state