Skip to contents

Create new Quetzio object

Usage

Quetzio_create(
  source_method,
  module_id,
  source_yaml = NULL,
  source_yaml_default = NULL,
  source_gsheet_id = NULL,
  source_gsheet_sheetname = NULL,
  source_object = NULL,
  source_object_default = NULL,
  output_gsheet = FALSE,
  output_gsheet_id = NULL,
  output_gsheet_sheetname = NULL,
  questionee_id = NULL,
  desc_yaml = NULL,
  desc_gsheet_id = NULL,
  desc_gsheet_sheetname = NULL,
  desc_object = NULL,
  randomize_order = FALSE,
  div_id = NULL,
  custom_css = NULL,
  lang = "en",
  custom_txts = NULL,
  use_modal = TRUE,
  render_ui = TRUE,
  link_id = NULL
)

Arguments

source_method

character string specifying in what form the source config file will be provided. Can be either 'gsheet', 'yaml' or 'raw'. Necessity of other arguments is dependent on this choice. For more info see 'details'

module_id

character string with unique id for the module. If not specified, it will be automatically generated

source_yaml

path to the source yaml file

source_yaml_default

path to the optional default options for items generated with source list. Only when source_method == 'yaml' or source_method == 'raw' and source object of class list is povided..

source_gsheet_id

id of the source googlesheet file

source_gsheet_sheetname

name of the source spreadsheet

source_object

object of class list (similiar in structure to 'yaml' source) or data.frame (similiar in structure to 'googlesheet' source) to be the source of questions. You can create a sample data.frame with create_survey_source(). Needed when source_method == 'raw'

source_object_default

list containing optional default options for items generated with source list. Only when source_method == 'yaml' or source_method == 'raw' and source object of class list is povided.

output_gsheet

logical: do you wish to save the answers automatically to the googlesheet. If TRUE, the 'output_gsheet_id' and 'output_gsheet_sheetname' arguments need to be specified. Defaults to FALSE

output_gsheet_id

id of the output googlesheet file. If not specified, the same googlesheet as for 'source' will be used

output_gsheet_sheetname

name of the output spreadsheet

questionee_id

reactive object containing ID of the questionee to append to the answers list during its retrieval with Quetzio_get_df or sending to googlesheets. Optional.

desc_yaml

path to the optional instruction and item descriptions.

desc_gsheet_id

id of the googlesheet to provide optional instruction and item descriptions. Defaults to 'source_gsheet_id', if not provided.

desc_gsheet_sheetname

name of source for optional instruction and item descriptions.

desc_object

object of class list or data.frame to be the source of optional instruction and item descriptions.

randomize_order

logical: do you wish to randomize order in which the items will appear? Defaults to FALSE

div_id

character string with unique id for the created div. If not specified, it will be set to 'form'

custom_css

custom css for classes 'mandatory star' and 'invalid_input'. If not specified, default look will be used:

  • invalid_input = "outline: red; outline-style: dashed; outline-offset: 10px;"

  • mandatory_star = "color: red;"

  • quetzio_submit = "color: #fff; background-color: #337ab7; border-color: #2e6da4; width: 200px;"

  • quetzio_description = "font-size: 0.9em;"

You can also add styles for different classes contained within the div of the questionnaire - styles will be affecting only elements within this specific questionnaire.

lang

language to use. For now only 'en' and 'pl' are supported.

custom_txts

named list with custom labels for specified language. For more information look upon documentation for 'quetzio_txt'

use_modal

logical indicating if modalDialog for invalid inputs should be triggered. Defaults to TRUE

render_ui

logical indicating if the UI for questionnaire should be rendered

link_id

character specifying the 'link_id' of the 'quetzio_link_server' object, modifying its namespace. Only used internally, if the questionnaire is part of linked server. Don't set it manually!

Value

R6 object of class Quetzio

Details

Currently, there are multiple methods both for source, which will generate the inputs, and for output. Mandatory arguments change depending of your choices:

  • for source:

    • source_method == 'yaml': 'source_yaml'

    • source_method == 'gsheet': 'source_gsheet_id,' 'source_gsheet_sheetname'

    • source_method == 'raw': 'source_object'

  • for output:

    • output_gsheet == TRUE: 'output_gsheet_id' (if other than 'source_gsheet_id') and 'output_gsheet_sheetname'

There are also some optional functionalities, that can be used with sources.

  • optional instructions and item descriptions - they are generated only if one of the following is provided:

    • desc_yaml: rendering from YAML file

    • desc_gsheet_sheetname: rendering from googlesheet. If the source_method isn't gsheet or the 'googlesheet_id' containing description is different from source, the desc_gsheet_id need to be provided too

    • desc_object: rendering from R object of classes 'data.frame' or 'list'

  • optional default configuration - it is used per shinyInput type. Need to provide either source_yaml_default or source_object_default.