GenerateHTMLQuestion: Generate HTMLQuestion

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/GenerateHTMLQuestion.R

Description

Generate an HTMLQuestion data structure for use in the ‘Question’ parameter of CreateHIT.

Usage

1
GenerateHTMLQuestion(character = NULL, file = NULL, frame.height = 450)

Arguments

character

An optional character string from which to construct the HTMLQuestion data structure.

file

An optional character string containing a filename from which to construct the HTMLQuestion data structure.

frame.height

A character string containing the integer value (in pixels) of the frame height for the HTMLQuestion iframe.

Details

Must specify either character or file.

To be valid, an HTMLQuestion data structure must be a complete XHTML document, including doctype declaration, head and body tags, and a complete HTML form (including the form tag with a submit URL, the assignmentId for the assignment as a form field, at least one substantive form field (can be hidden), and a submit button that posts to the external submit URL; see GenerateExternalQuestion.). If you fail to include a complete form, workers will be unable to submit the HIT. See the API Documentation for a complete example.

MTurkR comes pre-installed with several simple examples of HTMLQuestion HIT templates, which can be found by examining the templates directory of the installed package directory. These examples include simple HTMLQuestion forms, as well as templates for categorization, linking to off-site surveys, and sentiment analysis. Note that the examples, while validated complete, do not include CSS styling.

Value

A list containing xml.parsed, an XML data structure, string, xml formatted as a character string, and url.encoded, character string containing a URL query parameter-formatted HTMLQuestion data structure for use in the question parameter of CreateHIT.

Author(s)

Thomas J. Leeper

References

API Reference

See Also

CreateHIT

GenerateExternalQuestion

GenerateHITLayoutParameter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
f <- system.file("templates/htmlquestion1.xml", package = "MTurkR")
a <- GenerateHTMLQuestion(file=f)

hit1 <- 
CreateHIT(title = "Survey",
          description = "5 question survey",
          reward = ".10",
          expiration = seconds(days = 4),
          duration = seconds(hours = 1),
          keywords = "survey, questionnaire",
          question = a$string)

ExpireHIT(hit1$HITId)
DisposeHIT(hit1$HITId)

## End(Not run)

leeper/MTurkR documentation built on April 3, 2018, 5:27 p.m.