build_experiment: Build the experiment files

Description Usage Arguments Details Value

View source: R/build_experiment.R

Description

Build the experiment files

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
build_experiment(
  timeline,
  path,
  experiment_folder = "experiment",
  data_folder = "data",
  experiment_title = NULL,
  jsPsych_path = file.path(system.file("extdata", "jsPsych", package = "jaysire")),
  resources = NULL,
  columns = NULL,
  ...
)

Arguments

timeline

A timeline object

path

A string specifying the path in which to build the experiment

experiment_folder

A string specifying the experiment subfolder

data_folder

A string specifying the data subfolder

experiment_title

A string specifying the title of the experiment

jsPsych_path

A string specifying the path to jsPsych

resources

A tibble specifying how to construct resource files, or NULL

columns

Additional data values (constants) to store

...

Arguments to pass to jsPsych.init()

Details

The build_experiment() function is used to build the actual jsPsych experiment from the abstract description contained in the timeline argument. The input for the timeline argument should be a timeline constructed using build_timeline() and the path argument should specify the path to the folder in which the experiment files should be created. If the experiment needs to rely on resource files (e.g., images, audio files etc) then the resources argument should be a tibble containing the information needed to copy those files to the appropriate location. The easiest way to do so is by using the build_resources() function: see the documentation for that function for a more detailed description of what this tibble should contain.

When called, the build_experiment() function writes all the experiment files, compiled to javascript and HTML. The file structure it creates is as follows. Within the path folder are two subfolders, data_folder and experiment_folder (named "data" and "experiment" by default). The data_folder folder is empty, but intended to serve as a location to which data files can be written. The experiment_folder folder contains the "index.html" file, which is the primary source file for the experiment page, and an "experiment.js" file that specifies the jsPsych timeline and calls the jsPsych.init() javascript function that starts the experiment running. It also contains a "resource" folder with other necessary files (see build_resources() for detail). If specified, experiment_title will set the name of the experiment as the title of the HTML file in "index.html". jsPsych_path is a string that specifies the path to jsPsych.

Because build_experiment() creates the call to jsPsych.init(), it can also be used to specify any parameters that the user may wish to pass to that function via the .... There are quite a number of parameters you can specify this way:

Note: as of the current writing not all of these have been tested (even informally) through jaysire. Please report any unexpected behaviour by opening an issue on the GitHub page.

Value

Invisibly returns NULL


djnavarro/jaysire documentation built on April 12, 2021, 4:25 a.m.