Description Usage Arguments Format Details Examples
Used in 'RAVE' module file 'comp.R'
to define
input components
1 2 3 4 5 6 7 8 9 10 | define_input(
definition,
init_args,
init_expr,
keyword = "inputId",
update_level = 2,
...
)
UPDATE_LEVEL
|
definition |
R expression; see example or details |
init_args |
arguments to change when data is loaded |
init_expr |
expression to calculate argument values |
keyword |
argument refering to shiny input ID, default is
|
update_level |
update level: 1, 2, or 0; see details. |
... |
passed to other methods |
An object of class list
of length 3.
definition
is un-evaluated R expression defining shiny inputs
for example textInput('text_id', 'Input:')
. All inputs in the
following packages are supported: 'shiny' , 'dipsaus', 'ravecore',
'raveio'
Because when defining inputs, there is no assumption on data content, all
inputs values/choices should not be hard-coded. For example, before
any subject is loaded, condition types are unknown, hence an input selecting
condition types will need 'choices' to be reloaded once subject is loaded.
init_args
specify which arguments need to be changed once data
is loaded. init_expr
will be evaluated after initialization code
and variables created during this procedure will be used to update input
arguments.
update_level
has three levels: 1 is render only, updating input
only results in outputs to be re-rendered; 2 is run all, not only outputs
will be re-rendered, main function will be executed; 0 is manual input,
meaning the input will remain as ordinary shiny input and one has to
use shiny observer to capture value changes
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 | ## Not run:
# This code is ran in rave_validate
repo <- loaded_rave_repository(
'demo/DemoSubject' ,
reference = 'default',
epoch = 'auditory_onset',
before_onset = 1,
after_onset = 2
)
define_input(
# No condition is known before data/subject is chosen
# repo is not available at this time
definition = shiny::selectInput(inputId = 'cond', label = 'Condition',
choices = character(0), selected = NULL),
# two arguments will be changed once subject is loaded
init_args = c('choices', 'selected'),
init_expr = {
# at this moment, you know some information about subject
# for example, repo is created and is available
choices <- unique(repo$epoch$table$Condition)
# So does selected
selected <- raveio::get_val2(repo, 'cond', choices[[1]])
}
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.