check.colnames: Check the column names of a Sklar's Omega data matrix for...

View source: R/sklarsomega.R

check.colnamesR Documentation

Check the column names of a Sklar's Omega data matrix for correctness.

Description

Check the column names of a Sklar's Omega data matrix for correctness.

Usage

check.colnames(data)

Arguments

data

a matrix of scores. Each row corresponds to a unit, each column a coder.

Details

This function performs a somewhat rudimentary validation of the column names. At most one column may be labeled 'g', and said column must be the first. The only other valid format is 'c.C.S', where 'C' denotes coder number and 'S' denotes the Sth score for coder C (both positive whole numbers). It is up to the user to ensure that the coder and score indices make sense and are ordered correctly, i.e., coders, and scores for a given coder, are numbered consecutively.

Value

check.colnames returns a list comprising two elements.

success

logical; if TRUE, the column names passed the test.

cols

if success is FALSE, vector cols contains the numbers of the problematic column names.

References

Krippendorff, K. (2013). Computing Krippendorff's alpha-reliability. Technical report, University of Pennsylvania.

Examples

# The following data were presented in Krippendorff (2013).

data.nom = matrix(c(1,2,3,3,2,1,4,1,2,NA,NA,NA,
                    1,2,3,3,2,2,4,1,2,5,NA,3,
                    NA,3,3,3,2,3,4,2,2,5,1,NA,
                    1,2,3,3,2,4,4,1,2,5,1,NA), 12, 4)
colnames(data.nom) = c("c.1.1", "c.2.1", "c.3.1", "c.4.1")
data.nom
(check.colnames(data.nom))

# Introduce errors for columns 1 and 4.

colnames(data.nom) = c("c.a.1", "c.2.1", "c.3.1", "C.4.1")
(check.colnames(data.nom))

# The following scenario passes the check but is illogical.

colnames(data.nom) = c("g", "c.2.1", "c.1.47", "c.2.1")
(check.colnames(data.nom))

sklarsomega documentation built on April 4, 2023, 5:15 p.m.