get_golem_options: Get all or one golem options

Description Usage Arguments Value Examples

View source: R/with_opt.R

Description

This function is to be used inside the server and UI from your app, in order to call the parameters passed to run_app().

Usage

1

Arguments

which

NULL (default), or the name of an option

Value

The value of the option.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## Not run: 
  
  # Define and use golem_options
  
  # 1. Pass parameters to `run_app`
  
  # to set default value, edit run_app like this :
  run_app <- function(
    title = "this",
    content = "that"
  ) {
    with_golem_options(
      app = shinyApp(
        ui = app_ui,
        server = app_server
      ),
      golem_opts = list(
        p1 = p1,
        p3 = p3
      )
    )
  }
  
  # 2. Get the values from the UI side
  
  h1( get_golem_options("title") )
  
  # 3. Get the value from the server-side
  
  output$param <- renderPrint({
    paste("param p2 = ",get_golem_options("p2"))
  })
  

## End(Not run)

golem documentation built on April 17, 2021, 9:06 a.m.