Learn R Programming

OpenRepGrid (version 0.1.17)

addAvgElement: Add a new average element

Description

A new element is added to the grid. The scores are the arithmetic means across all selected elements.

Usage

addAvgElement(x, name = "avg", i, digits = Inf)

Value

A repgrid object with additional new element.

Arguments

x

A repgrid object.

name

Name of new element.

i

Indexes of elements to be averaged across. Negative indexes can be used to exclude elements from the complete set. Duplicate indexes are allowed but a warning is issued.

digits

Digits to round mean value to. By default no rounding is used (digits = Inf). Use digits = 0 to round to nearest integer, i.e. only using original integer rating scores.

Examples

Run this code
addAvgElement(feixas2004, "others", i = 2:12)
addAvgElement(feixas2004, "others", i = 2:12, digits = 0) # integers

# exluding elements via negative indexes
addAvgElement(feixas2004, "others", i = c(-1, -13))

Run the code above in your browser using DataLab