使用R中的Mturkr包创建HIT时获取HIT状态

时间:2015-10-14 07:38:00

标签: r mechanicalturk

    library("MTurkR")
    credentials(c("EXAMPLEAWSKEY","EXAMPLEAWSSCERETKEY"))
    AccountBalance()
    #Fetching AccountBalance=$0.00

    # First set qualifications
    # ListQualificationTypes() to see different qual types
    qualReqs = paste(

        # Set Location to US only
        GenerateQualificationRequirement(
            "Location","==","US"),

        sep="" )

    # Create new batch of hits:
    newHIT = CreateHIT(

        # layoutid in sandbox:
        hitlayoutid="EXAMPLEHITLAYOUTID",
        sandbox=T,
        annotation = "HET Experiment with Pre-Screen",
        assignments = "1200",
        title="Rate this hypothetical representative",
        description="It's easy, just rate this
            hypothetical representative on how well
            she delivers funds to his district",
        reward=".50",
        duration=seconds(hours=4),
        expiration=seconds(days=7),
        keywords="survey, question, answers, research,
                politics, opinion",
        auto.approval.delay=seconds(days=15),
        qual.reqs=qualReqs
    )

    # Get HITId (record result below)
    newHIT$HITId

    HITStatus(hit="EXAMPLEHITID")
    #not able to fetch HIT STATUS.
    #I Can see HIT been Created in Worker Sandbox, But after submitting the   by the worker I am not able to fetch anything. 

review = GetAssignments(hit="Example HITID",
    status="Submitted", return.all=T)

我收到以下错误:

  

错误(AWS.MechanicalTurk.HITDoesNotExist):命中3IV1AEQ4DRV9ICWQ5F0YS4QBNVOJ85不存在。 (1444808078544)

     

#Error in while(request $ total> runningtotal){:    #缺少值需要TRUE / FALSE

1 个答案:

答案 0 :(得分:0)

这个很简单,实际上,尽管没有非常丰富的信息(第二个)错误消息。您已经在沙箱中创建了一个HIT,但是您正试图在实时服务器上检查它的状态,而不存在它。

您可以通过将sandbox = FALSE(或options(MTurkR.sandbox = TRUE))参数传递给每个函数来解决此问题,并在所有代码中保持一致。更简单的替代方法是指定全局选项:

Writers

在代码的开头,然后您可以根据需要轻松切换打开和关闭。