stage: Create a stage for an experiment

Description Usage Arguments Format Details Value See Also Examples

Description

Stages are the building blocks of experiments. A single stage can result in one or more HTML pages shown to participants.

Usage

1
2
3
4
5
stage(handler, name = "No name")

NEXT

WAIT

Arguments

handler

A function which returns either a character string containing HTML, a Rook::Response object, the constant WAIT, or the constant NEXT.

name

optional name of the stage.

Format

1
Class 'NEXT'  num -1

Details

If WAIT is returned, the participant will be shown a standard "waiting page" which refreshes after a defined time interval. If HTML or a Response object is returned, then it is passed back to the participant. In these cases the stage will be called again next time the participant makes a request. If NEXT is returned, the participant will be moved forward to the next period, and the next stage will be called immediately.

Value

a Stage object suitable for adding to an experiment.

See Also

Other stages: checkpoint; form_stage; period; program; text_stage; timed

Examples

1
2
3
4
5
6
stg <- stage(function(id, period, params) {
 if(params$done=="OK") return(NEXT)
 c("<html><body><p>Your ID is ", id, " and the period is", period,
       "</p><form action='' method=POST>
       <input type='Submit' name='done' value='OK'></form></body><html>")
})

hughjonesd/betr documentation built on May 17, 2019, 9:11 p.m.