2  Quick Guide

Pre-requisites

For jsPsychHelpeR and jsPsychMaker, you will need R and RStudio desktop

For jsPsychMonkeys, you will need Docker. See the Monkeys’ setup section for more detailed instructions.

2.1 jsPsychMaker: Create an experimental protocol


See the jsPsychMaker chapter for more detailed instructions.


Outline
  1. Install jsPsychMaker

  2. create_protocol() using any of the list_available_tasks() or your own tasks defined in csv/xls files, and edit the config.js to adapt the protocol settings

  3. Open index.html in your browser


1) Install jsPsychMaker

Open RStudio and run the following line in the console. This will install the jsPsychMaker package from the Github repository.

if (!require('pak')) utils::install.packages('pak'); pak::pkg_install("gorkang/jsPsychMaker")

# If you are on Ubuntu and you get an igraph error, try: sudo apt install build-essential gfortran

2) Create protocol

Create and test a fully working protocol with jsPsychMaker::create_protocol().

Include the canonical_tasks you want (list the available tasks with jsPsychMaker::list_available_tasks()). You have more details in available-tasks. If you need new tasks, see New tasks.

  jsPsychMaker::create_protocol(canonical_tasks = c("AIM", "EAR", "IRI"),
                                folder_output = "~/Downloads/protocol999", 
                                launch_browser = TRUE)

You must edit config.js to adapt the protocol to your needs. See experiment configuration for more details.

3) Run experiment

The experiment is ready to run on your computer. Open index.html in Google Chrome or your favorite (and up to date) browser.

2.2 jsPsychMonkeys: Simulate participants


See the jsPsychMonkeys chapter for more detailed instructions.


jsPsychMonkeys uses Selenium inside a Docker container to guarantee each session is a clean session. See how to setup your computer.


Outline
  1. Install jsPsychMonkeys and Docker

  2. Run Monkeys


1) Install jsPsychMonkeys and Docker

if (!require('pak')) utils::install.packages('pak'); pak::pkg_install("gorkang/jsPsychMonkeys")

# If you are on Ubuntu and you get an igraph error, try: sudo apt install build-essential gfortran

Go to Docker Desktop and install it.

2) Run Monkeys

If you are on Windows, make sure Docker Desktop is open and running before releasing the monkeys.

Use the uid parameter to set the participants’ numeric id’s, e.g. uid = 1:10 would launch monkeys 1 to 10.

Use the local_folder_tasks parameter to indicate the location of the jsPsychMakeR protocol. If you are on Windows, local_folder_tasks value should be something similar to C:/Users/myusername/Downloads/protocol999.

jsPsychMonkeys::release_the_monkeys(uid = 1:10, 
                                    local_folder_tasks = "~/Downloads/protocol999/")

If the protocol was running from a local folder, the Monkey’s responses will be copied to a subfolder .data/ inside the local_folder_tasks. In the example above, ~/Downloads/protocol999/.data. If the protocol was running on the server (see the server_folder_tasks parameter), the data will be in the protocols’ .data/ folder inside the server.

2.3 jsPsychHelpeR: Prepare data


See the jsPsychHelpeR chapter for more detailed instructions.


Outline
  1. Install jsPsychHelpeR

  2. Create new project

  3. Run data preparation


1) Install jsPsychHelpeR

  • Install jsPsychHelpeR from Github.
if (!require('pak')) utils::install.packages('pak'); pak::pkg_install("gorkang/jsPsychHelpeR")

# If you are on Ubuntu and you get an igraph error, try: sudo apt install build-essential gfortran

2) Create new project

Create and setup a new RStudio project for your data. Before doing this, you need to locate the raw data for the jsPsychMaker project.

In this example, our raw data is in ~/Downloads/protocol999/.data/ and we want the new data preparation project to be in ~/Downloads/jsPsychHelpeR999/

jsPsychHelpeR::run_initial_setup(pid = '999', 
                                 data_location = '~/Downloads/protocol999/.data/', 
                                 folder = '~/Downloads/jsPsychHelpeR999/')

After this, a new RStudio project will open.

3) Run data preparation

Run the data preparation in the new RStudio project with targets::tar_make()

# Restore all the necessary packages using renv
renv::restore(prompt = FALSE)

# Run data preparation
targets::tar_make()

If you are curious, running targets::tar_visnetwork(targets_only = TRUE) will show the whole data preparation targets tree. Open the file run.R for more details.