format.subsets: format subsets

Description Usage Arguments Examples

Description

Formats the selected subsets for alternative output.

Usage

1

Arguments

sdf

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
##---- 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 (sdf) 
{
    numRow <- nrow(sdf)
    numCol <- ncol(sdf)
    numDCol <- numCol%/%5
    if ((numCol%%5) > 0) 
        numDCol <- numDCol + 1
    sd <- data.frame(c(1:numRow))[, -1]
    row <- 1
    while (row <= numRow) {
        col <- 1
        dCol <- 1
        while (col <= numCol) {
            if ((col + 4) < numCol) {
                endCol <- col + 4
            }
            else {
                endCol <- numCol
            }
            sd[row, dCol] <- paste(paste(ifelse(sdf[row, col:endCol] == 
                TRUE, "T", ".")), collapse = "")
            col <- col + 5
            dCol <- dCol + 1
        }
        row <- row + 1
    }
    col <- 1
    dCol <- 1
    sdNames <- c(1)
    while (col <= numCol) {
        if ((col + 4) < numCol) {
            endCol <- col + 4
        }
        else {
            endCol <- numCol
        }
        this.name <- c(seq(col + 1, endCol))
        this.index <- this.name[1]%/%10
        this.name <- this.name%%10
        sdNames[dCol] <- paste(col, endCol, sep = "-")
        col <- col + 5
        dCol <- dCol + 1
    }
    names(sd) <- sdNames
    sd
  }

aasrinivasan/hleaps documentation built on May 10, 2019, 4:05 a.m.