Running examples in ‘psychotools-Ex.R’ failed
The error most likely occurred in:

> ### Name: itemresp
> ### Title: Data Structure for Item Response Data
> ### Aliases: itemresp is.na.itemresp labels.itemresp labels<-.itemresp
> ###   length.itemresp levels.itemresp mscale.itemresp mscale<-.itemresp
> ###   names.itemresp names<-.itemresp rep.itemresp str.itemresp
> ###   xtfrm.itemresp
> ### Keywords: classes
> 
> ### ** Examples
> 
> ## binary responses to three items, coded as matrix
> x <- cbind(c(1, 0, 1, 0), c(1, 0, 0, 0), c(0, 1, 1, 1))
> ## transformed to itemresp object
> xi <- itemresp(x)
> 
> ## printing (see also ?print.itemresp)
> print(xi)
[1] {1,1,0} {0,0,1} {1,0,1} {0,0,1}
> print(xi, labels = TRUE)
[1] {item1:1,item2:1,item3:0} {item1:0,item2:0,item3:1}
[3] {item1:1,item2:0,item3:1} {item1:0,item2:0,item3:1}
> 
> ## subsetting/indexing (see also ?subset.itemresp)
> xi[2]
[1] {0,0,1}
> xi[c(TRUE, TRUE, FALSE, FALSE)]
[1] {1,1,0} {0,0,1}
> subset(xi, items = 1:2)
[1] {1,1} {0,0} {1,0} {0,0}
> dim(xi)
[1] 4 3
> length(xi)
[1] 4
> 
> ## summary/visualization (see also ?summary.itemresp)
> summary(xi)
      0 1
item1 2 2
item2 3 1
item3 1 3
> plot(xi)
> 
> ## query/set measurement scale labels
> ## extract mscale (tries to collapse to vector)
> mscale(xi)
[1] 0 1
> ## extract as list
> mscale(xi, simplify = FALSE)
$item1
[1] 0 1

$item2
[1] 0 1

$item3
[1] 0 1

> ## replacement by list
> mscale(xi) <- list(item1 = c("no", "yes"),
+   item2 = c("nay", "yae"), item3 = c("-", "+"))
> xi
[1] {yes,yae,-} {no,nay,+}  {yes,nay,+} {no,nay,+} 
> mscale(xi)
$item1
[1] "no"  "yes"

$item2
[1] "nay" "yae"

$item3
[1] "-" "+"

> ## replacement with partially named list plus default
> mscale(xi) <- list(item1 = c("n", "y"), 0:1)
> mscale(xi)
$item1
[1] "n" "y"

$item2
[1] "0" "1"

$item3
[1] "0" "1"

> ## replacement by vector (if number of categories constant)
> mscale(xi) <- c("-", "+")
> mscale(xi, simplify = FALSE)
$item1
[1] "-" "+"

$item2
[1] "-" "+"

$item3
[1] "-" "+"

> 
> ## query/set item labels and subject names
> labels(xi)
[1] "item1" "item2" "item3"
> labels(xi) <- c("i1", "i2", "i3")
> names(xi)
NULL
> names(xi) <- c("John", "Joan", "Jen", "Jim")
> print(xi, labels = TRUE)
            John             Joan              Jen              Jim 
{i1:+,i2:+,i3:-} {i1:-,i2:-,i3:+} {i1:+,i2:-,i3:+} {i1:-,i2:-,i3:+} 
> 
> ## coercion (see also ?as.list.itemresp)
> ## to integer matrix
> as.matrix(xi)
     i1 i2 i3
John  1  1  0
Joan  0  0  1
Jen   1  0  1
Jim   0  0  1
> ## to data frame with single itemresp column
> as.data.frame(xi)
          xi
John {+,+,-}
Joan {-,-,+}
Jen  {+,-,+}
Jim  {-,-,+}
> ## to list of factors
> as.list(xi)
$i1
John Joan  Jen  Jim 
   +    -    +    - 
Levels: - +

$i2
John Joan  Jen  Jim 
   +    -    -    - 
Levels: - +

$i3
John Joan  Jen  Jim 
   -    +    +    + 
Levels: - +

> ## to data frame with factors
> as.list(xi, df = TRUE)
     i1 i2 i3
John  +  +  -
Joan  -  -  +
Jen   +  -  +
Jim   -  -  +
> 
> 
> ## polytomous responses with missing values and unequal number of
> ## categories in a data frame
> d <- data.frame(
+   q1 = c(-2, 1, -1, 0, NA, 1, NA),
+   q2 = c(3, 5, 2, 5, NA, 2, 3),
+   q3 = factor(c(1, 2, 1, 2, NA, 3, 2), levels = 1:3,
+     labels = c("disagree", "neutral", "agree")))
> di <- itemresp(d)
Error in all.equal(as.integer(data[, i]), data[, i]) : 
  'list' object cannot be coerced to type 'integer'
Calls: itemresp -> isTRUE -> all.equal
Execution halted