View source: R/crosssectional_consensus_cluster.R
crosssectional_consensus_cluster | R Documentation |
This function uses the ConsensusClusterPlus
function from the package
with the same name with defaults for clustering data with categorical
variables. As the distance function, the Gower distance is used.
crosssectional_consensus_cluster(
data,
reps = 1000,
finalLinkage = "ward.D2",
innerLinkage = "ward.D2",
...
)
data |
a matrix or data.frame containing variables that should be used
for computing the distance. This argument is passed to |
reps |
number of repetitions, same as in |
finalLinkage |
linkage method for final clustering,
same as in |
innerLinkage |
linkage method for clustering steps,
same as in |
... |
other arguments passed to |
data
can take all input data types that gower.dist
can handle, i.e. numeric
, character
/factor
, ordered
and logical
.
The output is produced by ConsensusClusterPlus
dc <- mtcars
# scale continuous variables
dc <- sapply(mtcars[, 1:7], scale)
# code factor variables
dc <- cbind(as.data.frame(dc),
vs = as.factor(mtcars$vs),
am = as.factor(mtcars$am),
gear = as.factor(mtcars$gear),
carb = as.factor(mtcars$carb))
cc <- crosssectional_consensus_cluster(
data = dc,
reps = 10,
seed = 1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.