# NOT RUN {
# generate an AnswerKey from a list of arguments
qs <- list(list(QuestionIdentifier = "Question1",
AnswerOption = list(SelectionIdentifier="A", AnswerScore=15),
AnswerOption = list(SelectionIdentifier="B", AnswerScore=10),
DefaultScore = 5),
list(QuestionIdentifier = "Question2",
AnswerOption = list(SelectionIdentifier="D", AnswerScore=10) ) )
scoring1 <- list(PercentageMapping=5)
scoring2 <- list(RangeMapping=list(list(InclusiveLowerBound=0,
InclusiveUpperBound=20,
QualificationValue=5),
list(InclusiveLowerBound=21,
InclusiveUpperBound=100,
QualificationValue=10)),
OutOfRangeQualificationValue=0)
ak1 <- GenerateAnswerKey(qs, scoring1)
ak2 <- GenerateAnswerKey(qs, scoring2)
# generate an AnswerKey template from a QualificationTest
qt <- system.file("templates", "qualificationtest1.xml", package = "MTurkR")
akt <- AnswerKeyTemplate(xmlParse(qt))
# use the template to generate an AnswerKey
ak <- GenerateAnswerKey(ak)
# }
Run the code above in your browser using DataLab