Description Usage Arguments Details Value Functions
Functions that generate object of class form_partials
.
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 | generate_form(
prompt = "",
question = NULL,
choices = NULL,
validate = NULL,
confirm = FALSE,
pre = NULL,
post = NULL,
field_name = "",
extra_space = " "
)
generate_form_pattern(
prompt = "",
question = NULL,
choices = NULL,
pattern = "*",
confirm = FALSE,
pre = NULL,
post = NULL,
field_name = ""
)
generate_form_choices(
prompt = "",
question = NULL,
choices,
confirm = FALSE,
pre = NULL,
post = NULL,
field_name = ""
)
|
prompt |
The string printed when prompting the user for input (see |
question |
The question to be asked. |
choices |
A vector of choices. |
validate |
A function used to validate the answer (see details), if |
confirm |
a logical. Should the answer be confirmed (default is |
pre |
A function for pre-processing. |
post |
A function for post-processing. |
field_name |
Field name (optional) that will be used in the list of answer. |
extra_space |
extra space in prompt line. |
pattern |
pattern to be matched (see |
The object of class form_partial
returned is a function with one argument (x
) that triggers the following actions once called:
displays a question to be asked (question
);
prompts a message (prompt
) that is used to specify the nature of the input;
if confirm = TRUE
then a confirmation messages will be prompted;
(optional) calls the function pre
that transforms the input;
validates the input (validate
), i.e. returns TRUE
if the input (that may have been transformed) is valid;
(optional) applies a function (post
) to the validated input that thereby becomes output
The argument x
of a form_partial
is set to NULL
, it can however be set to a different value. In such case, once the object is called, the interactive steps (the first three steps aforementioned) are skipped and the input goes through the 3 last steps. If the input is not validated then NA
will be returned.
A object of class form_partial
.
generate_form_pattern
: match pattern.
generate_form_choices
: list fo choices.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.