Skip to content
Vess Popov edited this page Dec 11, 2020 · 5 revisions

This tutorial is OUTDATED. It applies to Concerto releases up to v5.0.beta.7.

Purpose of Node

To put an if statement into the flowchart logic. The user can enter an R conditional which will be evaluated and then the relevant branch will be followed based on whether the result was TRUE or FALSE.

Useful anywhere where you want to test whether something is true, and then show the user different responses based on that. e.g. if you only need women for your experiment and the user entered their gender as male, then you might show men a "thank-you for participating" screen.

Tips to Use Node

Here is a quick reference of some arithmetic and logical R operators that you might use when using the if statement node:

Operator Description
+ addition
- subtraction
* multiplication
/ division
< less than
<= less than or equal to
> greater than
>= greater than or equal to
== exactly equal to
!= not equal to
!x not x
x | y x or y
x & y x and y

If you are running into any errors when using this node, here are some things you should check for:

  • Are you using the correct data type? It could be that Concerto is treating your age values as characters, so make sure to include as.numeric() or the relevant data type conversation to ensure your R conditional compiles correctly.
  • Remember that the logical operator in R that means exactly equal to is ==, not =
  • Have the parameters that you require for your conditional go through the input labeled 'databank' on the if statement node and then refer to them as objects in the databank list; e.g. databank$age to refer to the age parameter.

Examples

Display different versions of the test depending on gender

The flowchart below shows a simple test that is different depending on the participant's gender.

Firstly, you have to specify the gender parameter that you will be using in your if statement conditional. For this, edit the form node accordingly

And provide the necessary response options.

Secondly, ensure that the form 'response' output is linked to the 'databank' input of the if statement node and edit the 'if_statement' input accordingly.

Clone this wiki locally