powered by
Converts numeric matrix to data frame with necessary format for "manual" CPC() calculation.
"manual"
CPC()
CPCdata.frame(data, cols, clusters)
Returns a data frame with dimensions identical to those of data.
data
a numeric n x k matrix or data frame.
n x k
columns in data to be used for calculating CPC().
column in data giving cluster membership.
data <- matrix(c(rnorm(50, 0, 1), rnorm(50, 5, 1)), ncol = 2, byrow = TRUE) clusters <- matrix(c(rep(1, 25), rep(2, 25)), ncol = 1) data <- cbind(data, clusters) CPCdata.frame(data, 1:2, 3)
Run the code above in your browser using DataLab