简体   繁体   中英

Tips for Integrating R code into a Mechanical Turk (e.g.) task?

I would like to randomize survey respondents on Mechanical Turk (or Survey Monkey, or a comparable web-based instrument) to particular conditions using my own R code. For example, the respondent might answer five background questions, then be exposed to a random question. I want to use the background data, run my R code on it, and return the question to the respondent immediately. (To be clear, I have a particular way I want to do the randomization in R that differs from complete randomization or random allocation of, eg, 60% to one condition, 40% to the other.)

Any suggestions for how to go about integrating R code into a web-based survey like this?

Have you considered having MTurk query a web server which you control running R on it to get its randomization? You could then just feed MTurk a spreadsheet with ID codes, put those ID codes in the URL to the web server, and the web server could keep track of which IDs it randomized to what.

A demonstration of how simple this might be is in Section 3 here: http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RApacheProject/paper.pdf

Another more end user-oriented walkthrough: http://www.jstatsoft.org/v08/i10/paper

Could also look to Rweb, but that would be less secure. Many other options exist .

Basically you want Mechanical Turk to load a frame with your webpage in it. The webpage it requests would have a CGI submit embedded in it ( eg MT loads a frame with the contents of the URL http://www.myserver.com/myproject.html?MTid=10473 ). Then your R script on the web server does the randomization, returns a webpage containing only the random number, and records on the web server which MTid was in the URL and which random number was generated. At the end just merge the web server's data with the MT data by the MTid.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM