Skip to contents

Sets the module state from the userdata under the specified id

Usage

FM_set_mod_state(session, id, state)

Arguments

session

Shiny session variable

id

ID string for the module.

state

Module state to set.

Value

Session variable with the module state set.

Examples

# We need a Shiny session variable and a module state
# object to use this function:
id="UD"
sess_res = UD_test_mksession(session=list(), id=id)
#> → 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
session = sess_res$session
state   = sess_res$state
FM_set_mod_state(session, id, state)
#> $userData
#> $userData$FM
#> $userData$FM$FM_UD
#> $userData$FM$FM_UD$yaml
#> $userData$FM$FM_UD$yaml$FM
#> $userData$FM$FM_UD$yaml$FM$include
#> $userData$FM$FM_UD$yaml$FM$include$files
#> $userData$FM$FM_UD$yaml$FM$include$files[[1]]
#> $userData$FM$FM_UD$yaml$FM$include$files[[1]]$file
#> $userData$FM$FM_UD$yaml$FM$include$files[[1]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.docx\")"
#> 
#> $userData$FM$FM_UD$yaml$FM$include$files[[1]]$file$dest
#> [1] "file.path(\"config\",\"report.docx\")"
#> 
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$include$files[[2]]
#> $userData$FM$FM_UD$yaml$FM$include$files[[2]]$file
#> $userData$FM$FM_UD$yaml$FM$include$files[[2]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.pptx\")"
#> 
#> $userData$FM$FM_UD$yaml$FM$include$files[[2]]$file$dest
#> [1] "file.path(\"config\",\"report.pptx\")"
#> 
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$include$files[[3]]
#> $userData$FM$FM_UD$yaml$FM$include$files[[3]]$file
#> $userData$FM$FM_UD$yaml$FM$include$files[[3]]$file$source
#> [1] "file.path(system.file(package=\"onbrand\"), \"templates\", \"report.yaml\")"
#> 
#> $userData$FM$FM_UD$yaml$FM$include$files[[3]]$file$dest
#> [1] "file.path(\"config\",\"report.yaml\")"
#> 
#> 
#> 
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$deployed
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$code
#> $userData$FM$FM_UD$yaml$FM$code$theme
#> [1] "vibrant_ink"
#> 
#> $userData$FM$FM_UD$yaml$FM$code$showLineNumbers
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$yaml$FM$code$gen_file
#> [1] "run_analysis.R"
#> 
#> $userData$FM$FM_UD$yaml$FM$code$gen_preamble
#> [1] "# formods automated output ------------------------------------------------\n# https://formods.ubiquity.tools/\nrm(list=ls())"
#> 
#> $userData$FM$FM_UD$yaml$FM$code$packages
#> [1] "onbrand" "writexl"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications
#> $userData$FM$FM_UD$yaml$FM$notifications$config
#> $userData$FM$FM_UD$yaml$FM$notifications$config$success
#> $userData$FM$FM_UD$yaml$FM$notifications$config$success$useFontAwesome
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$success$useIcon
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$success$background
#> [1] "#5bb85b"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$failure
#> $userData$FM$FM_UD$yaml$FM$notifications$config$failure$useFontAwesome
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$failure$useIcon
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$failure$background
#> [1] "#d9534f"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$info
#> $userData$FM$FM_UD$yaml$FM$notifications$config$info$useFontAwesome
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$info$useIcon
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$info$background
#> [1] "#5bc0de"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$warning
#> $userData$FM$FM_UD$yaml$FM$notifications$config$warning$useFontAwesome
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$warning$useIcon
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$yaml$FM$notifications$config$warning$background
#> [1] "#f0ac4d"
#> 
#> 
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting
#> $userData$FM$FM_UD$yaml$FM$reporting$enabled
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$content_init
#> $userData$FM$FM_UD$yaml$FM$reporting$content_init$xlsx
#> [1] "rpt = list(summary = NULL,\n           sheets  = list())"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$content_init$docx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.docx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$content_init$pptx
#> [1] "rpt  = onbrand::read_template(\n  template = file.path(\"config\", \"report.pptx\"),\n  mapping  = file.path(\"config\", \"report.yaml\"))"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[1]]
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[1]]$name
#> [1] "HEADERLEFT"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[1]]$location
#> [1] "header"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[1]]$value
#> [1] ""
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[1]]$tooltip
#> [1] "left header text"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[2]]
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[2]]$name
#> [1] "HEADERRIGHT"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[2]]$location
#> [1] "header"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[2]]$value
#> [1] ""
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[2]]$tooltip
#> [1] "right header text"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[3]]
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[3]]$name
#> [1] "FOOTERLEFT"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[3]]$location
#> [1] "footer"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[3]]$value
#> [1] ""
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs[[3]]$tooltip
#> [1] "left footer text"
#> 
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs_formatting
#> $userData$FM$FM_UD$yaml$FM$reporting$phs_formatting$width
#> [1] "100%"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs_formatting$tt_position
#> [1] "left"
#> 
#> $userData$FM$FM_UD$yaml$FM$reporting$phs_formatting$tt_size
#> [1] "medium"
#> 
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$ui
#> $userData$FM$FM_UD$yaml$FM$ui$button_style
#> [1] "fill"
#> 
#> $userData$FM$FM_UD$yaml$FM$ui$select_size
#> [1] 10
#> 
#> $userData$FM$FM_UD$yaml$FM$ui$color_green
#> [1] "#00BB8A"
#> 
#> $userData$FM$FM_UD$yaml$FM$ui$color_red
#> [1] "#FF475E"
#> 
#> $userData$FM$FM_UD$yaml$FM$ui$color_blue
#> [1] "#0088FF"
#> 
#> $userData$FM$FM_UD$yaml$FM$ui$color_purple
#> [1] "#bd2cf4"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_header
#> [1] "<span style='color:===COLOR==='><b>===NAME===</b><br/><font size='-3'>===LABEL===</font></span>"
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$subtext
#> [1] "===LABEL===: ===RANGE==="
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$many_sep
#> [1] ",⋅⋅⋅,"
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$character
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$character$color
#> [1] "#DD4B39"
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$character$label
#> [1] "text"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$double
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$double$color
#> [1] "#3C8DBC"
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$double$label
#> [1] "num"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$integer
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$integer$color
#> [1] "#3C8DBC"
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$integer$label
#> [1] "num"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$other
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$other$color
#> [1] "black"
#> 
#> $userData$FM$FM_UD$yaml$FM$data_meta$data_types$other$label
#> [1] "other"
#> 
#> 
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$labels
#> $userData$FM$FM_UD$yaml$FM$labels$default_ds
#> [1] "Original data set"
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$user_files
#> $userData$FM$FM_UD$yaml$FM$user_files$use_tmpdir
#> [1] TRUE
#> 
#> 
#> $userData$FM$FM_UD$yaml$FM$logging
#> $userData$FM$FM_UD$yaml$FM$logging$enabled
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$yaml$FM$logging$timestamp
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$yaml$FM$logging$timestamp_fmt
#> [1] "%Y-%m-%d %H:%M:%S"
#> 
#> $userData$FM$FM_UD$yaml$FM$logging$log_file
#> [1] "formods_log.txt"
#> 
#> $userData$FM$FM_UD$yaml$FM$logging$console
#> [1] TRUE
#> 
#> 
#> 
#> 
#> $userData$FM$FM_UD$MC
#> $userData$FM$FM_UD$MC$compact
#> $userData$FM$FM_UD$MC$compact$code
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$MC$compact$preview
#> [1] TRUE
#> 
#> 
#> $userData$FM$FM_UD$MC$reporting
#> $userData$FM$FM_UD$MC$reporting$enabled
#> [1] FALSE
#> 
#> $userData$FM$FM_UD$MC$reporting$priority
#> [1] 1
#> 
#> 
#> $userData$FM$FM_UD$MC$labels
#> $userData$FM$FM_UD$MC$labels$default_ds
#> [1] "Original data set"
#> 
#> $userData$FM$FM_UD$MC$labels$upload_button
#> [1] "Select file"
#> 
#> $userData$FM$FM_UD$MC$labels$tab_main
#> [1] "Upload file"
#> 
#> $userData$FM$FM_UD$MC$labels$tab_code
#> [1] "Code"
#> 
#> $userData$FM$FM_UD$MC$labels$tab_preview
#> [1] "Data preview"
#> 
#> $userData$FM$FM_UD$MC$labels$switch_clean
#> [1] "Clean column names on upload"
#> 
#> $userData$FM$FM_UD$MC$labels$msg_bad_extension
#> [1] "Incorrect file extension (===EXT===). Unable to load file  ===FILE===.\nOnly the following extesions are allowed: ===ALLOWEDEXT===."
#> 
#> 
#> $userData$FM$FM_UD$MC$tooltips
#> $userData$FM$FM_UD$MC$tooltips$include
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$MC$tooltips$show_code
#> [1] "Show data reading code"
#> 
#> 
#> $userData$FM$FM_UD$MC$formatting
#> $userData$FM$FM_UD$MC$formatting$preview
#> $userData$FM$FM_UD$MC$formatting$preview$width
#> [1] 800
#> 
#> $userData$FM$FM_UD$MC$formatting$preview$height
#> [1] 500
#> 
#> 
#> $userData$FM$FM_UD$MC$formatting$code
#> $userData$FM$FM_UD$MC$formatting$code$width
#> [1] 500
#> 
#> $userData$FM$FM_UD$MC$formatting$code$height
#> [1] 200
#> 
#> 
#> $userData$FM$FM_UD$MC$formatting$switch_clean
#> $userData$FM$FM_UD$MC$formatting$switch_clean$tooltip
#> [1] "Strange characters in column names can cause problems. When switched on, this will clean up the column headers and fix those that might break things."
#> 
#> $userData$FM$FM_UD$MC$formatting$switch_clean$tooltip_position
#> [1] "bottom"
#> 
#> 
#> 
#> $userData$FM$FM_UD$MC$allowed_extensions
#> [1] "csv"  "tsv"  "xls"  "xlsx"
#> 
#> $userData$FM$FM_UD$MC$code
#> $userData$FM$FM_UD$MC$code$packages
#> [1] "readxl"  "readr"   "janitor"
#> 
#> $userData$FM$FM_UD$MC$code$readOnly
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$MC$code$mode
#> [1] "r"
#> 
#> $userData$FM$FM_UD$MC$code$preamble
#> [1] "# Loading data ------------------------------------------------------------"
#> 
#> 
#> $userData$FM$FM_UD$MC$ds_object_name
#> [1] "myDS"
#> 
#> $userData$FM$FM_UD$MC$clean_data
#> $userData$FM$FM_UD$MC$clean_data$enabled
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$MC$clean_data$default
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$MC$clean_data$code
#> [1] "# Make sure you put whatever packages you use here in the packages section\n# above.\n#\n# contents - data frame containing the loaded dataset.\n# code     - code used to load the dataset you need to append any cleaning\n#            code you generate  here.\n# object_name - Name of the dataset object used in generated code.\nif(system.file(package=\"janitor\") != \"\"){\n  contents = janitor::clean_names(contents, case=\"none\")\n  code = paste0(code, '\\n', object_name, ' = janitor::clean_names(', object_name,', case=\"none\")')\n}"
#> 
#> 
#> 
#> $userData$FM$FM_UD$UD
#> $userData$FM$FM_UD$UD$isgood
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$UD$clean
#> [1] TRUE
#> 
#> $userData$FM$FM_UD$UD$load_msg
#> <em>File loaded.</em>
#> 
#> $userData$FM$FM_UD$UD$data_file_local
#> [1] "/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T//RtmpUdhu6j/non_shiny/FM/TEST_DATA.xlsx"
#> 
#> $userData$FM$FM_UD$UD$data_file_ext
#> [1] "xlsx"
#> 
#> $userData$FM$FM_UD$UD$data_file
#> [1] "TEST_DATA.xlsx"
#> 
#> $userData$FM$FM_UD$UD$sheet
#> NULL
#> 
#> $userData$FM$FM_UD$UD$sheets
#> [1] "DATA" "DDT" 
#> 
#> $userData$FM$FM_UD$UD$code
#> [1] "myDS = readxl::read_excel(path=\"TEST_DATA.xlsx\", sheet=\"DATA\")\nmyDS = janitor::clean_names(myDS, case=\"none\")"
#> 
#> $userData$FM$FM_UD$UD$object_name
#> [1] "myDS"
#> 
#> $userData$FM$FM_UD$UD$checksum
#> [1] "897d952fecbc804999396a96f9df4b20"
#> 
#> $userData$FM$FM_UD$UD$contents
#> # A tibble: 10,680 × 33
#>       ID TIME_DY TIME_HR NTIME_DY NTIME_HR  TIME     AMT    DV RECDESC     DOSE
#>    <dbl>   <dbl>   <dbl>    <dbl>    <dbl> <dbl>   <dbl> <dbl> <chr>      <dbl>
#>  1     1       0       0        0        0     0 3000000    0  dose     3000000
#>  2     1       0       0        0        0     0       0 1250  BM_ng_ml 3000000
#>  3     1       0       0        0        0     0       0    0  C_ng_ml  3000000
#>  4     1       1      24        1       24    24       0 1647  BM_ng_ml 3000000
#>  5     1       1      24        1       24    24       0  690. C_ng_ml  3000000
#>  6     1       2      48        2       48    48       0 1947  BM_ng_ml 3000000
#>  7     1       2      48        2       48    48       0  588. C_ng_ml  3000000
#>  8     1       3      72        3       72    72       0 2170  BM_ng_ml 3000000
#>  9     1       3      72        3       72    72       0  506. C_ng_ml  3000000
#> 10     1       4      96        4       96    96       0 2332  BM_ng_ml 3000000
#> # ℹ 10,670 more rows
#> # ℹ 23 more variables: DOSE_STR <chr>, Cohort <chr>, ROUTE <chr>, WT <dbl>,
#> #   SUBTYPE <chr>, SEX <chr>, F1 <dbl>, ka <dbl>, CL <dbl>, Vc <dbl>, Vp <dbl>,
#> #   Q <dbl>, BM_IC <dbl>, kdeg_BM <dbl>, Emax <dbl>, EC50 <dbl>, CMT <chr>,
#> #   DUR <dbl>, EVID <dbl>, NDose <chr>, DOSE_NUM <dbl>, SUBTYPE_ID <dbl>,
#> #   SEX_ID <dbl>
#> 
#> 
#> $userData$FM$FM_UD$MOD_TYPE
#> [1] "UD"
#> 
#> $userData$FM$FM_UD$id
#> [1] "UD"
#> 
#> $userData$FM$FM_UD$FM_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpNZoppn/temp_libpathad101dd5172f/formods/templates/formods.yaml"
#> 
#> $userData$FM$FM_UD$MOD_yaml_file
#> [1] "/private/var/folders/pq/7srbf_fx3rd3k706hgxkg61r0000gp/T/RtmpNZoppn/temp_libpathad101dd5172f/formods/templates/UD.yaml"
#> 
#> $userData$FM$FM_UD$shiny_token
#> [1] "non_shiny"
#> 
#> 
#> 
#>