Skip to contents

Fetches the datasets contained in the module.

Usage

UD_fetch_ds(state)

Arguments

state

UD state from UD_fetch_state()

Value

Character object vector with the lines of code

list containing the following elements

  • isgood: Return status of the function.

  • hasds: Boolean indicator if the module has any datasets

  • msgs: Messages to be passed back to the user.

  • ds: List with datasets. Each list element has the name of the R-object for that dataset. Each element has the following structure:

    • label: Text label for the dataset

    • MOD_TYPE: Short name for the type of module.

    • id: module ID

    • idx: unique numerical ID to identify this dataset in the module.

    • DS: Dataframe containing the actual dataset.

    • DSMETA: Metadata describing DS, see FM_fetch_ds() for details on the format.

    • code: Complete code to build dataset.

    • checksum: Module checksum.

    • DSchecksum: Dataset checksum.

Examples

# YAML configuration files from the package:
FM_yaml_file  = system.file(package = "formods", "templates", "formods.yaml")
MOD_yaml_file = system.file(package = "formods", "templates", "UD.yaml")
# This is the module id:
id = "UD"
# Within shiny both session and input variables will exist,
# this creates examples here for testing purposes:
sess_res = UD_test_mksession(session=list())
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → ASM:   dest:   file.path("config","report.docx")
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → ASM:   dest:   file.path("config","report.pptx")
#> → ASM: including file
#> → ASM:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → ASM:   dest:   file.path("config","report.yaml")
#> → ASM: State initialized
#> → ASM: module isgood: TRUE
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.docx")
#> → UD:   dest:   file.path("config","report.docx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.pptx")
#> → UD:   dest:   file.path("config","report.pptx")
#> → UD: including file
#> → UD:   source: file.path(system.file(package="onbrand"), "templates", "report.yaml")
#> → UD:   dest:   file.path("config","report.yaml")
#> → UD: State initialized
#> → UD: module checksum updated:897d952fecbc804999396a96f9df4b20
#> → UD: module isgood: TRUE
session = sess_res$session
input   = sess_res$input
state = UD_fetch_state(
           id            = id,
           input         = input,
           session       = session,
           FM_yaml_file  = FM_yaml_file,
           MOD_yaml_file = MOD_yaml_file )
#> → UD: module checksum updated:897d952fecbc804999396a96f9df4b20
  
 ds_res = UD_fetch_ds(state)