CRAN Package Check Results for Package psychotools

Last updated on 2015-03-31 03:48:38.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.4-0 1.53 34.00 35.52 OK
r-devel-linux-x86_64-debian-gcc 0.4-0 1.48 33.69 35.17 OK
r-devel-linux-x86_64-fedora-clang 0.4-0 68.49 OK
r-devel-linux-x86_64-fedora-gcc 0.4-0 68.58 OK
r-devel-osx-x86_64-clang 0.4-0 70.43 OK
r-prerel-windows-ix86+x86_64 0.4-0 11.00 67.00 78.00 OK
r-prerel-linux-x86_64 0.4-0 1.48 35.12 36.60 OK
r-prerel-solaris-sparc 0.4-0 422.50 OK
r-prerel-solaris-x86 0.4-0 73.80 ERROR
r-release-linux-x86_64 0.4-0 1.66 36.66 38.32 OK
r-release-osx-x86_64-mavericks 0.4-0 OK
r-release-osx-x86_64-snowleopard 0.4-0 OK
r-release-windows-ix86+x86_64 0.4-0 8.00 67.00 75.00 OK
r-oldrel-windows-ix86+x86_64 0.4-0 9.00 75.00 84.00 OK

Check Details

Version: 0.4-0
Check: examples
Result: ERROR
    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)
    > di
     1 2 3 4 5 6
    {-2,3,dsgr} {1,5,ntrl} {-1,2,dsgr} {0,5,ntrl} {NA,NA,NA} {1,2,agre}
     7
    {NA,3,ntrl}
    >
    > ## auto-completion of mscale: full range (-2, ..., 2) for q1, starting
    > ## from smallest observed (negative) value (-2) to the same (positive)
    > ## value (2), full (positive) range for q2, starting from smallest
    > ## observed value (2) to largest observed value (5), missing category of
    > ## 4 is detected, for q3 given factor levels are used
    > mscale(di)
    $q1
    [1] "-2" "-1" "0" "1" "2"
    
    $q2
    [1] "2" "3" "4" "5"
    
    $q3
    [1] "disagree" "neutral" "agree"
    
    >
    > ## set mscale for q2 and add category 1, q1 and q3 are auto-completed:
    > di <- itemresp(d, mscale = list(q2 = 1:5))
    >
    > ## is.na.itemresp - only true for observation 5 (all missing)
    > is.na(di)
     1 2 3 4 5 6 7
    FALSE FALSE FALSE FALSE TRUE FALSE FALSE
    >
    > ## illustration for larger data set
    > data("VerbalAggression", package = "psychotools")
    > r <- itemresp(VerbalAggression$resp[, 1:12])
    > str(r)
     Item response data from 316 subjects for 12 items.
     S1WantCurse: 0, 1, 2
     S1DoCurse: 0, 1, 2
     S1WantScold: 0, 1, 2
     S1DoScold: 0, 1, 2
     S1WantShout: 0, 1, 2
     S1DoShout: 0, 1, 2
     S2WantCurse: 0, 1, 2
     S2DoCurse: 0, 1, 2
     S2WantScold: 0, 1, 2
     S2DoScold: 0, 1, 2
     S2WantShout: 0, 1, 2
     S2DoShout: 0, 1, 2
    > head(r)
    [1] {0,1,0,0,0,1,0,1,0,0,0,0} {0,0,0,0,0,0,0,0,0,0,0,0}
    [3] {1,0,1,1,1,1,1,0,0,0,1,1} {1,1,1,1,1,1,1,2,1,1,1,1}
    [5] {1,1,0,1,1,0,1,1,0,0,0,0} {2,2,2,0,0,0,2,2,0,0,0,0}
    > plot(r)
    > summary(r)
     0 1 2
    S1WantCurse 91 95 130
    S1DoCurse 91 108 117
    S1WantScold 126 86 104
    S1DoScold 136 97 83
    S1WantShout 154 99 63
    S1DoShout 208 68 40
    S2WantCurse 67 112 137
    S2DoCurse 109 97 110
    S2WantScold 118 93 105
    S2DoScold 162 92 62
    S2WantShout 158 84 74
    S2DoShout 238 53 25
    > prop.table(summary(r), 1)
     0 1 2
    S1WantCurse 0.2879747 0.3006329 0.41139241
    S1DoCurse 0.2879747 0.3417722 0.37025316
    S1WantScold 0.3987342 0.2721519 0.32911392
    S1DoScold 0.4303797 0.3069620 0.26265823
    S1WantShout 0.4873418 0.3132911 0.19936709
    S1DoShout 0.6582278 0.2151899 0.12658228
    S2WantCurse 0.2120253 0.3544304 0.43354430
    S2DoCurse 0.3449367 0.3069620 0.34810127
    S2WantScold 0.3734177 0.2943038 0.33227848
    S2DoScold 0.5126582 0.2911392 0.19620253
    S2WantShout 0.5000000 0.2658228 0.23417722
    S2DoShout 0.7531646 0.1677215 0.07911392
    >
    > ## dichotomize response
    > r2 <- r
    > mscale(r2) <- c(0, 1, 1)
    > plot(r2)
    >
    > ## transform to "likert" package
    > if(require("likert")) {
    + lik <- likert(as.data.frame(as.list(r)))
    + lik
    + plot(lik)
    + }
    Loading required package: likert
    Loading required package: ggplot2
    Loading required package: xtable
    Error: replacement has length zero
    Execution halted
Flavor: r-prerel-solaris-x86