longcov2mat:

Usage Arguments Examples

Usage

1
longcov2mat(x, Sid.col, dep.col)

Arguments

x
Sid.col
dep.col

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
##---- 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, Sid.col, dep.col) 
{
    if (is.null(dim(x))) 
        stop("x must be a matrix or data frame")
    Sid = unique(x[, Sid.col])
    res = list()
    nid = length(Sid)
    p = length(dep.col)
    n = nrow(x)
    flag = (x[, Sid.col] == Sid[1])
    n.each.s = sum(flag)
    ns = n/n.each.s
    if (!is.wholenumber(ns)) 
        stop("Not all S's have same number of rows of data")
    for (i in 1:ns) {
        flag = (x[, Sid.col] == Sid[i])
        res[[i]] = as.matrix(x[flag, dep.col])
    }
    res
  }

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