Create data.frame source compatible with shiny.survey
create_Quetzio_source.Rd
Create data.frame source compatible with shiny.survey
Usage
create_Quetzio_source(
method = "df",
gsheet_id = NULL,
gsheet_name = NULL,
gsheet_sheetname = "Questions"
)
Arguments
- method
Which method to use. One of 'df' (default) and 'gsheet'.
- gsheet_id
id if you want to append the sheet to existing googlesheet
- gsheet_name
optional name for your googlesheet. Used only if
method == 'gsheet'
- gsheet_sheetname
name for the spreadsheet name
Details
Function to help initialize source data.frame for quetzio generation. It should contain specific columns, which are created here alongside one placeholder input to help populating next ones.
Name suffix helps to determine for which types of inputs these columns are used. Variables without suffix are used in creation of which input types.
chr_
: textInputnum_
: numericInputselect_
: selectizeInputradio_
: radioButtonsmult_
: selectizeInput, radioButtons and likertRadioButtons
For more details about specific variables and their meaning check Question parameters section. For intricacies of every input type check their help pages.
'numericInput' uses actually custom 'numInput' function
'likertRadioButtons' is custom new shinyInput introduced with the package
To use 'gsheet' method, the 'googlesheets4' package needs to be installed.
You can create the source 'data.frame' yourself, keeping only the columns that are universally mandatory and specific to used inputTypes, though it is recommended to keep all columns that are created during initialization - the column classes should be kept.
When using 'googlesheet' as a source, all columns should be kept alongside their order to ensure correct import.
Question parameters
Bolded are mandatory. Parentheses contains the suffix that need to be provided during data.frame or googlesheets source creation. If you are creating a YAML or list source, provide the names without suffix.
All input types:
InputId: character Id for input
type: character Input type. One of 'textInput', 'numericInput', 'selectizeInput', 'radioButtons' or 'likertRadioButtons'
mandatory: boolean Is the question is mandatory
width: character CSS-valid width value
textInput:
placeholder: character Text that will be displayed before user provides their answer
(chr_)regex: character regex pattern to check validity
numericInput:
placeholder: character Text that will be displayed before user provides their answer
(num_)value: numeric Pre-filled value that will be placed. Leave empty or NA to no pre-fill.
(num_)min: numeric Minimal possible value
(num_)max: numeric Maximal possible value
(num_)step: numeric Step to increase/decrease value
selectizeInput:
placeholder: character Text that will be displayed before user provides their answer
(mult_)choices: character Options that will be presented to the user and will be saved as values. You can separate them with either
;
or\n
(mult_)choiceValues: character Values that will be saved per option. Need to be provided alongside choiceNames. You can separate them with either
;
or\n
(mult_)choiceNames: character Names of the options that will be displayed to the user. Need to be provided alongside choiceValues. You can separate them with either
;
or\n
(mult_)selected: character Value of the option to be preselect. No selection if left empty / NA
(select_)maxItems: numeric Number of items which the user will be able to select. Levae empty or NA to let the user choose all.
(select_)create: boolean Should the questionee be able to create their own value? Defaults to FALSE.
radioButtons:
(mult_)choices: character Options that will be presented to the user and will be saved as values. You can separate them with either
;
or\n
(mult_)choiceValues: character Values that will be saved per option. Need to be provided alongside choiceNames. You can separate them with either
;
or\n
(mult_)choiceNames: character Names of the options that will be displayed to the user. Need to be provided alongside choiceValues. You can separate them with either
;
or\n
(mult_)selected: character Value of the option to be preselect. No selection if left empty / NA
(radio_)inline: boolean Should the buttons be placed inline? Defaults to FALSE
likertRadioButtons:
placeholder: character Text that will be displayed before user provides their answer.
(mult_)choiceValues: character Values that will be saved per option. Need to be provided alongside choiceNames. You can separate them with either
;
or\n
(mult_)choiceNames: character Names of the options that will be displayed to the user. Need to be provided alongside choiceValues. You can separate them with either
;
or\n
(mult_)selected: character Value of the option to be preselect. No selection if left empty / NA