Learn R Programming

MTurkR (version 0.8.0)

GenerateQualificationRequirement: Generate QualificationRequirement

Description

Generate a QualificationRequirement data structure for use with CreateHIT or RegisterHITType.

Usage

GenerateQualificationRequirement(qual, 
                                 comparator, 
                                 value, 
                                 preview = NULL, 
                                 qual.number = NULL)

Arguments

qual

A character string containing a QualificationTypeId, or a vector of QualificationTypeIds. This parameter also accepts shorthand labels for built-in QualificationTypes: “Approved” (percent of assignments approved), “NumberApproved” (number of assignments approved), “Locale”, “Adult”, and MTurk “masters” QualificationTypes (“Masters”).

comparator

A character string containing a comparator, or a vector of comparators, by which a worker's score of a qualification is compared to the specified value. One of <,<=,>,>=,==,!=,“Exists”,“DoesNotExist”,“In”,“NotIn”. For “Masters”-type qualifications, only “Exists” and “DoesNotExist” are available.

value

A numeric or character string value (or vector of such) against which workers scores will be compared. Must be a non-negative integer, except when qualification="Locale" (when it must be a two-digit country code, or a five-character ISO 3166-2 identifier for a U.S. state of the form US-MN using the two-letter abbreviation for Minnesota, etc.) or when comparator is “Exists” or “DoesNotExist” (when it must be an empty character string). When using the “In” or “NotIn” comparators, each element in value can be a comma-separated string of up to 15 values (e.g., 15 discrete scores or 15 discrete locales to use for that Qualification).

preview

An optional logical specifying whether a worker must have the Qualification in order to preview the HIT on the MTurk worker site. The default is FALSE.

qual.number

An argument for primarily internal use.

Value

Returns a character string (of class “QualificationRequirement”) containing URL-encoded QualificationRequirements.

Details

A convenience function to translate the details of a QualificationRequirement into the necessary structure for use in the qual.req parameter of CreateHIT or RegisterHITType. The function accepts three required parameters: qual, comparator, and value. qual must be a valid QualificationTypeId for either a built-in QualificaitonType (see ListQualificationTypes) or a custom QualificationType (e.g., one created with CreateQualificationType). Multiple QualificationRequirements can be generated in one call --- that is, if a requester intends to impose multiple QualificationRequirements on a single HITType, those requirements must be specified in a single call to GenerateQualificationRequirements. Once attached to a HITType, only workers who meet all of the specified QualificationRequirements can complete assignments for a HIT of that HITType.

References

API Reference

See Also

CreateHIT

RegisterHITType

Examples

Run this code
# NOT RUN {
a <- ListQualificationTypes()[2,2] # Number of HITs Approved
# one QualificationRequirement
q1 <- GenerateQualificationRequirement(a,">","90")
# two QualificationRequirements
q2 <- GenerateQualificationRequirement(c("Locale","Approved"), 
                                       c("==",">"), 
                                       c("US",90), 
                                       preview = TRUE)
# one QualificationRequirement using the 'In' comparator
q3 <- GenerateQualificationRequirement("Locale","In","US,GB")
# two QualificationRequirements using the 'In' comparator
q4 <- GenerateQualificationRequirement(c("Locale","Approved"), 
                                       c("==",">"), 
                                       c("US,GB,DK",90), 
                                       preview = c(TRUE,FALSE))
# `Exists` comparator
q5 <- GenerateQualificationRequirement("Approved", "Exists", "")

# Masters `DoesNotExist` comparator
q6 <- GenerateQualificationRequirement("Masters", "DoesNotExist", "")

# U.S. state locale value
q7a <- GenerateQualificationRequirement("Locale","==","US-MN")
## with multiple states and an 'In' operator
q7b <- GenerateQualificationRequirement("Locale","In","US-MN,US-IL")

# Complex locale values
q8 <- GenerateQualificationRequirement("Locale","In","US-NY,US-WA,CA")
# }

Run the code above in your browser using DataLab