GenerateHITLayoutParameter: Generate a HITLayout Parameter

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

View source: R/GenerateHITLayoutParameter.R

Description

Generate a HITLayout parameter based upon the names of HIT template variables and the values to substitute for those variables in a single HIT. Used in collaboration with a HIT Layout ID from https://requester.mturk.com/create/projects in the CreateHIT operation.

Usage

1

Arguments

names

A character string containing the name of a HIT template variable or a vector of character strings containing the names of multiple HIT template variables. This is optional if values has a non-empty names attribute.

values

A character string containing the value of a HIT template variable to be inserted for a specific HIT or a vector of character strings containing the values of multiple HIT template variables to be inserted for a specific HIT. If values has a non-empty names attribute and names is missing, the names attribute is used.

Details

This function provides the content for the hitlayoutparameters option of CreateHIT. Specifically, a HIT Template created in the MTurk Requester User Interface (RUI) has a number of placeholder variables for content to be inserted. This fucntion supplies the content to be inserted into the template for one HIT. If multiple HITs are being created from one template, then GenerateHITLayoutParameter should be run once for each HIT.

Analogous functionality for producing .html files on the local workstation (e.g., to create multiple external HITs from the same template) is provided by GenerateHITsFromTemplate.

Value

A character string containing URL query parameter-formatted HITLayout parameters, to be used in the hitlayoutparameters parameter of CreateHIT.

Author(s)

Thomas J. Leeper

References

API Reference

See Also

CreateHIT

GenerateExternalQuestion

GenerateHITsFromTemplate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
# examples of specifying 'names' and 'values'
a <- GenerateHITLayoutParameter(names = "hitvariable", 
                                values = "Text for HIT 1")
b <- GenerateHITLayoutParameter(names = "hitvariable", 
                                values = "Text for HIT 2")
c <- GenerateHITLayoutParameter(names = c("hitvariable1","hitvariable2"),
                                values = c("Headline for HIT1","Text for HIT 1"))

# example using a named character string in lieu of specifying 'names'
d <- GenerateHITLayoutParameter(values = c(hitvariable1 = "Headline for HIT1", 
                                           hitvariable2 = "Text for HIT 1"))

# create HIT using layout parameter
hit1 <- 
CreateHIT(title = "Survey",
          description = "5 question survey",
          reward = ".10",
          expiration = seconds(days=4),
          duration = seconds(hours = 1),
          keywords = "survey, questionnaire",
            # retrieved from MTurk web interface:
          hitlayoutid = "23ZGOOGQSCM61T1H5H9U0U00OQWFFU", 
          hitlayoutparameters = a)

# cleanup
DisableHIT(hit1$HITId)

## End(Not run)

MTurkR documentation built on May 29, 2017, 11:09 p.m.