Skip to contents

Takes a question written in proper QDOC format and generates an object that is ready to be uploaded as a survey. See vignette("qdocs") for a guide to the QDOC format.

Usage

qdoc.question(text, quiet.fail = FALSE)

as.qdoc.question(text, quiet.fail = FALSE)

qdoc.q(text, quiet.fail = FALSE)

Arguments

text

text of question written in proper QDOC format.

quiet.fail

if cannot parse question, silently return an empty list (default is FALSE).

Value

An object for a particular QDOC question family (e.g. qdoc.single_choice, qdoc.multiple_choice, qdoc.matrix).

Examples

# multiple-choice (single answer)
qdoc.question("What is your gender?\n\nMale\nFemale\nOther")
#> What is your gender?
#> ○ Male
#> ○ Female
#> ○ Other
qdoc.question("[[Question:MC]]\nWhat is your gender?[[Choices]]\nMale\nFemale\nOther")
#> What is your gender?
#> ○ Male
#> ○ Female
#> ○ Other

# multiple-choice (multi-answer)
qdoc.question("What is your gender?[[MultiAnswer]]\n\nMale\nFemale\nOther")
#> What is your gender?
#> ■ Male
#> ■ Female
#> ■ Other
qdoc.question("[[Question:MC:MultiAnswer]]\nWhat is your gender?\n[[Choices]]\nMale\nFemale\nOther")
#> What is your gender?
#> ■ Male
#> ■ Female
#> ■ Other

# matrix
qdoc.question("Please rate the following:\n\na\nb\nc\n\n1\n2\n3")
#> Please rate the following:
#> 
#>   | 1 | 2 | 3 | 
#> ----------------
#> a | ○   ○   ○   
#> b | ○   ○   ○   
#> c | ○   ○   ○   
qdoc.question("[[Question:Matrix]]\nPlease rate the following:\n[[Rows]]\na\nb\nc\n[[Columns]]\n1\n2\n3")
#> Please rate the following:
#> 
#>   | 1 | 2 | 3 | 
#> ----------------
#> a | ○   ○   ○   
#> b | ○   ○   ○   
#> c | ○   ○   ○