trial_instructions: Specify pages of instructions to display

Description Usage Arguments Details Value

View source: R/trial_instructions.R

Description

The trial_instructions function is used to display one or more pages of instructions that a participant can browse.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
trial_instructions(
  pages,
  key_forward = keycode("right arrow"),
  key_backward = keycode("left arrow"),
  allow_backward = TRUE,
  allow_keys = TRUE,
  show_clickable_nav = FALSE,
  button_label_previous = "Previous",
  button_label_next = "Next",
  post_trial_gap = 0,
  on_finish = NULL,
  on_load = NULL,
  data = NULL
)

Arguments

pages

Character vector. Each element should be an HTML-formatted string specifying a page

key_forward

This is the key that the subject can press in order to advance to the next page, specified as their numeric key code or as characters

key_backward

This is the key that the subject can press in order to return to the previous page.

allow_backward

If TRUE, participants can navigate backwards

allow_keys

If TRUE, participants can use keyboard keys to navigate

show_clickable_nav

If TRUE, buttons will be shown to allow navigation

button_label_previous

Text on the "previous" button

button_label_next

Text on the "next" button

post_trial_gap

The gap in milliseconds between the current trial and the next trial. If NULL, there will be no gap.

on_finish

A javascript callback function to execute when the trial finishes

on_load

A javascript callback function to execute when the trial begins, before any loading has occurred

data

An object containing additional data to store for the trial

Details

The trial_instructions() function is used to generate trials that show instruction to the participant. It allows participants to navigate through multiple pages of instructions at their own pace, recording how long thet spend on each page. Navigation can be done using the mouse or keyboard. Participants can be allowed to navigate forwards and backwards through pages, if desired.

Specifying instructions

Other behaviour

Like all functions in the trial_ family it contains four additional arguments:

Data

When this function is called from R it returns the trial object that will later be inserted into the experiment when build_experiment is called. However, when the trial runs as part of the experiment it returns values that are recorded in the jsPsych data store and eventually form part of the data set for the experiment.

The data recorded by this trial is as follows:

In addition, it records default variables that are recorded by all trials:

Value

Functions with a trial_ prefix always return a "trial" object. A trial object is simply a list containing the input arguments, with NULL elements removed. Logical values in the input (TRUE and FALSE) are transformed to character vectors "true" and "false" and are specified to be objects of class "json", ensuring that they will be written to file as the javascript logicals, true and false.

Functions with a trial_ prefix always return a "trial" object. A trial object is simply a list containing the input arguments, with NULL elements removed. Logical values in the input (TRUE and FALSE) are transformed to character vectors "true" and "false" and are specified to be objects of class "json", ensuring that they will be written to file as the javascript logicals, true and false.


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