mat2list_1:

Usage Arguments Examples

Usage

1
MAT2list(x, J = NULL, p = NULL)

Arguments

x
J
p

Examples

 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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, J = NULL, p = NULL) 
{
    if (is.null(dim(x))) 
        stop("The argument x must be a matrix or data frame")
    y <- list()
    if (is.null(J) && is.null(p)) 
        stop("Specify J or P")
    if (is.null(J)) 
        J = ncol(x)/p
    if (is.null(p)) 
        p = ncol(x)/J
    Jp = floor(J) * floor(p)
    if (Jp != ncol(x)) 
        stop("Jp is not equal to the number of columns")
    lp = 1 - p
    up = 0
    for (j in 1:J) {
        lp = lp + p
        up = up + p
        y[[j]] <- as.matrix(x[, lp:up])
    }
    y
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.