Skip to content
This repository has been archived by the owner on May 24, 2019. It is now read-only.

Installation

Thomas J. Leeper edited this page Jun 12, 2018 · 13 revisions

To use MTurkR, you need to have R installed on your machine. It is available for multiple platforms from CRAN.

Once R is installed and open, the latest stable release of MTurkR can be installed from your local CRAN mirror and loaded using:

install.packages("MTurkR")
library("MTurkR")

To install the Graphical User Interface:

install.packages("MTurkRGUI")
library("MTurkRGUI")

The latest stable development releases of MTurkR and the GUI can be installed from the cloudyr drat repository:

install.packages(c("MTurkR", "MTurkRGUI"), 
                 repos = c(getOption("repos"), "http://cloudyr.github.io/drat"))

Potentially unstable releases can be installed directly from GitHub using devtools:

# latest (not necessarily stable) version from GitHub
if (!require("remotes")) {
    install.packages("remotes")
}
# Core package
remotes::install_github("cloudyr/MTurkR")
# GUI
remotes::install_github("cloudyr/MTurkRGUI")

Once installed, you will need to setup your AWS Account to work with MTurk (which involves giving yourself permission to use the API to control your MTurk developer account). In that tutorial, you'll be given an opportunity to create a "keypair" (your AWS Access Key ID and Secret Access Key) and once you have, you'll need to supply your "keypair" to use the package. You can do this using system environment variables (e.g., by setting them up system-wide, by incorporating them into the R startup procedures, in a .Renviron file in your working directory, or using the Sys.setenv() function). The values should be set as variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, respectively. When MTurkR is loaded, these environment variables will automatically be retrieved.

Using environment variables is preferred, but setting these in R is easy, for example:

Sys.setenv(AWS_ACCESS_KEY_ID = "my-access-key")
Sys.setenv(AWS_SECRET_ACCESS_KEY = "my-secret-access-key")

Your keypair can be generated on the IAM Management Console under the heading Access Keys. Note that you only have access to your secret key once. After it is generated, you need to save it in a secure location. New keypairs can be generated at any time if yours has been lost, stolen, or forgotten. In 2015, AWS also announced support for IAM credentials, so users do not have to have root access to an AWS account. The implementation offers to IAM policies - AmazonMechanicalTurkFullAccess or AmazonMechanicalTurkReadOnly - meaning that you should be able to grant use of MTurk to collaborators without them being able to spend money (on HITs and bonuses). This is a major advance in the security features of the MTurk Requester API.

Specifying your keypair via environment variables (e.g., in a .Renviron file) simplifies use of MTurkR and protects those credentials from being logged by R's console history, but you can always manually specify your keypair in each function call as a two-element character vector for the keypair argument.