Codebase list r-cran-libcoin / lintian-fixes/main tests / regtest_ctabs.Rout.save
lintian-fixes/main

Tree @lintian-fixes/main (Download .tar.gz)

regtest_ctabs.Rout.save @lintian-fixes/mainraw · history · blame

R Under development (unstable) (2017-12-04 r73829) -- "Unsuffered Consequences"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> library("libcoin")
> 
> x <- 1:6
> y <- rep(1:3, length.out = 6)
> w <- rep(2L, length(x))
> b <- gl(2, 3)
> s <- 1:4
> 
> ctabs(x)
[1] 0 1 1 1 1 1 1
> ctabs(x, weights = w)
[1] 0 2 2 2 2 2 2
> ctabs(x, subset = s)
[1] 0 1 1 1 1 0 0
> ctabs(x, weights = w, subset = s)
[1] 0 2 2 2 2 0 0
> ctabs(x, block = b)
     [,1] [,2]
[1,]    0    0
[2,]    1    0
[3,]    1    0
[4,]    1    0
[5,]    0    1
[6,]    0    1
[7,]    0    1
> ctabs(x, weights = w, block = b)
     [,1] [,2]
[1,]    0    0
[2,]    2    0
[3,]    2    0
[4,]    2    0
[5,]    0    2
[6,]    0    2
[7,]    0    2
> ctabs(x, subset = s, block = b)
     [,1] [,2]
[1,]    0    0
[2,]    1    0
[3,]    1    0
[4,]    1    0
[5,]    0    1
[6,]    0    0
[7,]    0    0
> ctabs(x, weights = w, subset = s, block = b)
     [,1] [,2]
[1,]    0    0
[2,]    2    0
[3,]    2    0
[4,]    2    0
[5,]    0    2
[6,]    0    0
[7,]    0    0
> 
> ctabs(x, y)
     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    1    0    0
[3,]    0    0    1    0
[4,]    0    0    0    1
[5,]    0    1    0    0
[6,]    0    0    1    0
[7,]    0    0    0    1
> ctabs(x, y, weights = w)
     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    2    0    0
[3,]    0    0    2    0
[4,]    0    0    0    2
[5,]    0    2    0    0
[6,]    0    0    2    0
[7,]    0    0    0    2
> ctabs(x, y, subset = s)
     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    1    0    0
[3,]    0    0    1    0
[4,]    0    0    0    1
[5,]    0    1    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0
> ctabs(x, y, weights = w, subset = s)
     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    2    0    0
[3,]    0    0    2    0
[4,]    0    0    0    2
[5,]    0    2    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0
> ctabs(x, y, block = b)
, , 1

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    1    0    0
[3,]    0    0    1    0
[4,]    0    0    0    1
[5,]    0    0    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0

, , 2

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    0    0    0
[3,]    0    0    0    0
[4,]    0    0    0    0
[5,]    0    1    0    0
[6,]    0    0    1    0
[7,]    0    0    0    1

> ctabs(x, y, weights = w, block = b)
, , 1

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    2    0    0
[3,]    0    0    2    0
[4,]    0    0    0    2
[5,]    0    0    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0

, , 2

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    0    0    0
[3,]    0    0    0    0
[4,]    0    0    0    0
[5,]    0    2    0    0
[6,]    0    0    2    0
[7,]    0    0    0    2

> ctabs(x, y, subset = s, block = b)
, , 1

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    1    0    0
[3,]    0    0    1    0
[4,]    0    0    0    1
[5,]    0    0    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0

, , 2

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    0    0    0
[3,]    0    0    0    0
[4,]    0    0    0    0
[5,]    0    1    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0

> ctabs(x, y, weights = w, subset = s, block = b)
, , 1

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    2    0    0
[3,]    0    0    2    0
[4,]    0    0    0    2
[5,]    0    0    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0

, , 2

     [,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    0    0    0    0
[3,]    0    0    0    0
[4,]    0    0    0    0
[5,]    0    2    0    0
[6,]    0    0    0    0
[7,]    0    0    0    0

> 
> w <- round(1:length(x) / length(x), 2)
> ctabs(x, weights = w)
[1] 0.00 0.17 0.33 0.50 0.67 0.83 1.00
> ctabs(x, weights = w, subset = s)
[1] 0.00 0.17 0.33 0.50 0.67 0.00 0.00
> ctabs(x, weights = w, block = b)
     [,1] [,2]
[1,] 0.00 0.00
[2,] 0.17 0.00
[3,] 0.33 0.00
[4,] 0.50 0.00
[5,] 0.00 0.67
[6,] 0.00 0.83
[7,] 0.00 1.00
> ctabs(x, weights = w, subset = s, block = b)
     [,1] [,2]
[1,] 0.00 0.00
[2,] 0.17 0.00
[3,] 0.33 0.00
[4,] 0.50 0.00
[5,] 0.00 0.67
[6,] 0.00 0.00
[7,] 0.00 0.00
> 
> ctabs(x, y, weights = w)
     [,1] [,2] [,3] [,4]
[1,]    0 0.00 0.00  0.0
[2,]    0 0.17 0.00  0.0
[3,]    0 0.00 0.33  0.0
[4,]    0 0.00 0.00  0.5
[5,]    0 0.67 0.00  0.0
[6,]    0 0.00 0.83  0.0
[7,]    0 0.00 0.00  1.0
> ctabs(x, y, weights = w, subset = s)
     [,1] [,2] [,3] [,4]
[1,]    0 0.00 0.00  0.0
[2,]    0 0.17 0.00  0.0
[3,]    0 0.00 0.33  0.0
[4,]    0 0.00 0.00  0.5
[5,]    0 0.67 0.00  0.0
[6,]    0 0.00 0.00  0.0
[7,]    0 0.00 0.00  0.0
> ctabs(x, y, weights = w, block = b)
, , 1

     [,1] [,2] [,3] [,4]
[1,]    0 0.00 0.00  0.0
[2,]    0 0.17 0.00  0.0
[3,]    0 0.00 0.33  0.0
[4,]    0 0.00 0.00  0.5
[5,]    0 0.00 0.00  0.0
[6,]    0 0.00 0.00  0.0
[7,]    0 0.00 0.00  0.0

, , 2

     [,1] [,2] [,3] [,4]
[1,]    0 0.00 0.00    0
[2,]    0 0.00 0.00    0
[3,]    0 0.00 0.00    0
[4,]    0 0.00 0.00    0
[5,]    0 0.67 0.00    0
[6,]    0 0.00 0.83    0
[7,]    0 0.00 0.00    1

> ctabs(x, y, weights = w, subset = s, block = b)
, , 1

     [,1] [,2] [,3] [,4]
[1,]    0 0.00 0.00  0.0
[2,]    0 0.17 0.00  0.0
[3,]    0 0.00 0.33  0.0
[4,]    0 0.00 0.00  0.5
[5,]    0 0.00 0.00  0.0
[6,]    0 0.00 0.00  0.0
[7,]    0 0.00 0.00  0.0

, , 2

     [,1] [,2] [,3] [,4]
[1,]    0 0.00    0    0
[2,]    0 0.00    0    0
[3,]    0 0.00    0    0
[4,]    0 0.00    0    0
[5,]    0 0.67    0    0
[6,]    0 0.00    0    0
[7,]    0 0.00    0    0

> 
> proc.time()
   user  system elapsed 
  0.288   0.052   0.333