2015-10-14 63 views
1
創建使用Mturkr包HIT
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) 

我收到以下錯誤:獲取命中狀態,而R中

Error (AWS.MechanicalTurk.HITDoesNotExist): Hit 3IV1AEQ4DRV9ICWQ5F0YS4QBNVOJ85 does not exist. (1444808078544)

# Error in while (request$total > runningtotal) { : # missing value where TRUE/FALSE needed

回答

0

這一個非常簡單,實際上,儘管不是非常翔實的(第二)的錯誤信息。您已經在沙盒中創建了一個HIT,但您正試圖檢查它在活動服務器上的狀態,它不存在。

您可以通過將sandbox = TRUE(或sandbox = FALSE)參數傳遞給每個函數來解決此問題,並在所有代碼中保持一致。一個更簡便的方法是指定一個全局選項:在你的代碼,然後你就可以輕鬆切換的開始和關閉需要

options(MTurkR.sandbox = TRUE)

+0

感謝您的幫助。 –