Generate an HTMLQuestion data structure for use in the ‘Question’ parameter of
An optional character string from which to construct the HTMLQuestion data structure.
An optional character string containing a filename from which to construct the HTMLQuestion data structure.
A character string containing the integer value (in pixels) of the frame height for the HTMLQuestion iframe.
Must specify either
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.
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
Thomas J. Leeper
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.