inst/data-raw/demoData.R

## generate demo matrices
## mlp matrix

set.seed(3)
points.amount <- 20
PCs <- 2

## Create the input matrix.
mlpMatrix <- matrix(
    c(
        sapply(1:PCs, function(xi)
            c(
                sample(
                    seq(
                        0.3,
                        1.0,
                        0.001
                    ),
                    replace=FALSE,
                    size=points.amount
                ),
                sample(
                    seq(
                        0.0,
                        0.7,
                        0.001
                    ),
                    replace=FALSE,
                    size=points.amount
                )
            )
        )
    ), ncol=PCs
)

groupNames <- c("class1", "class2")

## Create the group variable.
groups <- c(
    sapply(
        1:length(groupNames),
        function(ix, groupNames)
            rep(
                groupNames[ix],
                nrow(mlpMatrix)/length(groupNames)
            ),
        groupNames = groupNames
)
)

rownames(mlpMatrix) <- groups
colnames(mlpMatrix) <- paste("dim", 1:2, sep="")
save(mlpMatrix, file = "data/mlpMatrix.rda")

## pcp matrix
set.seed(3)
points.amount <- 20
PCs <- 3
groupNames <- c("class1", "class2", "class3")

pcpMatrix <- matrix(
    c(
        sapply(1:PCs, function(xi)
            c(
                sample(
                    seq(
                        0.0,
                        1.0,
                        0.001
                    ),
                    replace=FALSE,
                    size=points.amount
                ),
                sample(
                    seq(
                        0.5,
                        1.5,
                        0.001
                    ),
                    replace=FALSE,
                    size=points.amount
                ),
                sample(
                    seq(
                        0.0,
                        1.0,
                        0.001
                    ),
                    replace=FALSE,
                    size=points.amount
                )
            )
        )
    ), ncol=PCs
)

groups <- c(
    sapply(
        1:length(groupNames),
        function(ix, groupNames)
            rep(
                groupNames[ix],
                nrow(pcpMatrix)/length(groupNames)
            ),
        groupNames = groupNames
    )
)

rownames(pcpMatrix) <- groups
colnames(pcpMatrix) <- paste("dim", 1:PCs, sep="")
save(pcpMatrix, file = "data/pcpMatrix.rda")
jasonserviss/ClusterSignificance documentation built on May 9, 2019, 5:56 p.m.