Translations of this page:
 

valueSum()

float valueSum(string Question)

float valueSum(string Question, string|array Items)

float valueSum(array Variables)

Calculates the sum of answer codes for all items of a question (e.g. a scale), for selected items or for a list of variables.

  • Question – Die Kennung einer Frage (als String)
  • Items – A list (string or array) of items, e.g.
    • array(2,4,6)
    • [2,4,6]
    • '1-3,5,7'
  • Variables – A list (array) of variable identifiers according to the Variables overview, e.g.
    • ['AB01_01', 'AB01_02', 'BB01', 'BC01']

Note: The function valueSum() can only read regular variables from questions and items. The dwell time (“TIME001”, “TIME002”, …) cannot be read by means of valueSum(). Please use the function caseTime() and the operator for addition (+) for this.

Examples

Calculate sum over all responses in scale AB01.

$sum = valueSum('AB01');

Sum over items 2, 4, 6, and 8 of the AB01 scale.

$sum = valueSum('AB01', [2,4,6,8]);

Sum over the first 4 items of the AB01 scale.

$sum = valueSum('AB01', '1-4');

Sum over the responses in variables AB01_01, AB01_03, and BB01_02 (as array in square brackets).

$sum = valueSum(['AB01_01','AB01_03','BB01_02']);

The same command again a little more clearly

$sum = valueSum([
           'AB01_01',
           'AB01_03',
           'BB01_02'
       ]);
en/create/functions/valuesum.txt · Last modified: 05.09.2023 23:11 by swissel.uni-mannheim
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki