This file is indexed.

/usr/lib/R/site-library/gdata/unitTests/runit.nPairs.R is in r-cran-gdata 2.13.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
### runit.nPairs.R
###------------------------------------------------------------------------
### What: Number of variable pairs - unit tests
### $Id$
### Time-stamp: <2008-12-30 18:24:59 ggorjan>
###------------------------------------------------------------------------

### {{{ --- Test setup ---

if(FALSE) {
  library("RUnit")
  library("gdata")
}

### }}}
### {{{ --- nPairs ---

test.nPairs <- function()
{
  ## 'x' must be a data.frame or a matrix
  x <- rpois(100, lambda=10)
  checkException(nPairs(x=x))
  checkException(nPairs(x=table(x)))

  test <- data.frame(V1=c(1, 2, 3, 4, 5),
                     V2=c(NA, 2, 3, 4, 5),
                     V3=c(1, NA, NA, NA, NA),
                     V4=c(1, 2, 3, NA, NA))
  testCheck <- matrix(data=as.integer(c(5, 4, 1, 3,
                                        4, 4, 0, 2,
                                        1, 0, 1, 1,
                                        3, 2, 1, 3)),
                      nrow=4, ncol=4, byrow=TRUE)
  class(testCheck) <- c("nPairs", class(testCheck))

  testCheckNames <- testCheck
  colnames(testCheckNames) <- rownames(testCheckNames) <- colnames(test)

  checkIdentical(nPairs(x=test), testCheckNames)
  checkIdentical(nPairs(x=test, names=FALSE), testCheck)
  checkIdentical(nPairs(x=as.matrix(test)), testCheckNames)
  checkIdentical(nPairs(x=as.matrix(test), names=FALSE), testCheck)

  testCheck <- cbind(testCheckNames, as.integer(c(5, 4, 0, 0)))
  class(testCheck) <- class(testCheckNames)
  colnames(testCheck) <- c(colnames(test), "all")
  checkIdentical(nPairs(x=test, margin=TRUE), testCheck)

  testCheckSumm <- matrix(data=as.integer(c(0, 1, 4, 2,
                                            0, 0, 4, 2,
                                            0, 1, 0, 0,
                                            0, 1, 2, 0)),
                          nrow=4, ncol=4, byrow=TRUE)
  dimnames(testCheckSumm) <- dimnames(testCheckNames)
  tmp <- summary(nPairs(x=test))
  checkEquals(tmp, testCheckSumm)
}


### }}}
### {{{ Dear Emacs
### Local variables:
### folded-file: t
### end:
### }}}

###------------------------------------------------------------------------
### runit.nPairs.R ends here