longstring | R Documentation |
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.
longstring(x, avg = FALSE)
x |
a matrix of data (e.g. item responses) |
avg |
logical indicating whether to additionally return the average length of identical consecutive responses |
Richard Yentes ryentes@gmail.com, Francisco Wilhelm franciscowilhelm@gmail.com
Johnson, J. A. (2005). Ascertaining the validity of individual protocols from web-based personality inventories. Journal of Research in Personality, 39, 103-129. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jrp.2004.09.009")}
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.