longstring {careless}R Documentation

Identifies the longest string of identical consecutive responses for each observation

Description

Takes a matrix of item responses and, beginning with the second column (i.e., second item) compares each column with the previous one to check for matching responses. For each observation, the length of the maximum uninterrupted string of identical responses is returned. Additionally, can return the average length of uninterrupted string of identical responses.

Usage

longstring(x, avg = FALSE)

Arguments

x

a matrix of data (e.g. item responses)

avg

logical indicating whether to additionally return the average length of identical consecutive responses

Author(s)

Richard Yentes ryentes@gmail.com, Francisco Wilhelm franciscowilhelm@gmail.com

References

Johnson, J. A. (2005). Ascertaining the validity of individual protocols from web-based personality inventories. Journal of Research in Personality, 39, 103-129. doi:10.1016/j.jrp.2004.09.009

Examples

careless_long <- longstring(careless_dataset, avg = FALSE)
careless_avg <- longstring(careless_dataset, avg = TRUE)
boxplot(careless_avg$longstr) #produce a boxplot of the longstring index
boxplot(careless_avg$avgstr)

[Package careless version 1.2.2 Index]