Description Usage Arguments Details Value
View source: R/assembleHITHTML.R
Takes parameterized inputs from multiple script and HTML files to make one complete file. This function has two main uses: 1) Filling in all parameters, and making the HTML for a complete external HIT on MTurk. This includes filling in all content data (e.g., filling in titles, abstracts, questions, urls, or any other parameters that change in a series of HITs). 2) Assembling the script and HTML files together, leaving select parameters in tact, thus creating a template. This use would be useful for making the full shell for the content to be incorporated dynamically. Options in this function also allow for the creation of 'honey pot' hits with known answers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
honeyPot |
|
honeyPotVars |
the variable names to use for the honey pot. |
inputLoc |
the input file location for the input files. Not needed if files or code is directly entered into the function. Directory name should be only the string with no terminal slash (e.g., the default is |
content |
named |
quiet |
|
write.to |
a |
sandbox |
|
innerHTML.html |
HTML containing the inner body of the HIT. This code will be the same as used for intsance in |
skipPattern.js |
Javascript or jQuery that defines a skip pattern for questions. Optional. This is useful if some questions are irrelevant if a particular answer is given (e.g., if a study is not a randomized controlled trial, questions on randomization would be irrelevant). See details below. |
outerScript.js |
Javascript or jQuery for overall behavior of the HIT. The default script comes with helper functions for selecting cells in tables, enabling Bootstrap popovers, and enabling Bootstrap tooltips. See details below. |
honeyScript.js |
Javascript or jQuery that enables answer checking and dynamic form controls when a honey pot is uploaded. |
hitShell.html |
HTML containing additional content for the HIT, such as instructions and buttons. This is the backbone into which the submit buttons, script, and innerHTML will be assembled. See details below. |
honeyShell.html |
HTML containing additional content for the HIT for honey pots, replacing the |
hitButton.html |
Short HTML code to define the HIT submit button. See details below. |
honeyButton.html |
Dynamic HTML code that interacts with |
For any of the required files, input can take three forms.
The default is NULL
, which signals to the function that all required files will be found in the folder specified by inputLoc
(e.g., honeyButton.html
is expected, by default, to be in the subfolder input
).
Files can be specified if defined in with the file
function. For instance, if the innerHTML.html
file was named hitHTML.txt
in the current working directory, the input would be innerHTML.html = file("hitHTML.txt")
.
Finally, the input can be created and inserted as objects. This is particularly useful for the content
object. For instance, if one wanted to input the content from a file as well as additional parameters, one could assemble the content object and pass it to the function (e.g., one could read an file with gold-standard answers in to R, append additional columns containing the title and abstract, and pass this complete object to the function).
The returned object is either a long string
that contains the assembled HTML code (if quiet
is FALSE
), or is output to a file if write.to
is defined.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.