1 | fac2list(x, g)
|
x |
|
g |
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 | ##---- 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, g)
{
g = as.data.frame(g)
L = ncol(g)
g = listm(g)
for (j in 1:L) g[[j]] = as.factor(g[[j]])
g = matl(g)
Lp1 = L + 1
if (L > 4)
stop("Can have at most 4 factors")
if (L == 1) {
res = selby(cbind(x, g), 2, 1)
group.id = res$grpn
res = res$x
}
if (L > 1) {
res = selby2(cbind(x, g), c(2:Lp1), 1)
group.id = res$grpn
res = res$x
}
print("Group Levels:")
print(group.id)
res
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.