Skip to content

createMutuallyExclusive

Jesse Lingeman edited this page Aug 27, 2013 · 1 revision

Purpose

Takes two columns and creates a new column that combines the arguments of those two columns into one column. This merges the arguments in the cells into new cells, and will create new cells based on the onsets/offsets of cells in both columns.

Parameters

New Variable Name

The name of the resulting new column

Variable 1 Name

The name of the first variable or the RVariable object of the first variable. Both are accepted.

Variable 2 Name

The name of the second variable or the RVariable object of the second variable. Both are accepted.

Variable 1 Argument Prefex (optional)

The prefix to use for the arguments of the first variable. This will be affixed to the front of the argument names. Use this in case both columns have arguments that are named the same. By default the variable 1 name is prefixed to the argument name, so for a variable called "test" and an argument called "trialnum", the resulting argument name is "test_trialnum" in the new column.

Variable 2 Argument Prefex (optional)

The prefix to use for the arguments of the second variable. This will be affixed to the front of the argument names. Use this in case both columns have arguments that are named the same. By default the variable 2 name is prefixed to the argument name, so for a variable called "test" and an argument called "trialnum", the resulting argument name is "test_trialnum" in the new column.

Example

# Get a variable called trial from the database, store it in a Ruby variable called trial
trial = getVariable("trial")

# Get another variable from the database called "walk"
walk = getVariable("walk")

# Now we want to create a new column by muxing the two together
trialwalk = createMutuallyExclusive("trial_walk", trial, walk)

# Write it back to the database
setVariable(trialwalk)

Clone this wiki locally