GenerateHTMLQuestion | R Documentation |
Generate an HTMLQuestion data structure for use in the ‘Question’
parameter of CreateHIT
.
GenerateHTMLQuestion(character = NULL, file = NULL, frame.height = 450)
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. |
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.
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
.
Tyler Burleigh, Thomas J. Leeper
CreateHIT
GenerateExternalQuestion
## Not run:
f <- system.file("templates/htmlquestion1.xml", package = "pyMTurkR")
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.