Converts numeric matrix to data frame with necessary format for
"manual"
CPC()
calculation.
Arguments
- data
a numeric
n x k
matrix or data frame.- cols
columns in
data
to be used for calculatingCPC()
.- clusters
column in
data
giving cluster membership.
Examples
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)
#> V1 V2 cluster
#> 1 -0.48789948 -0.63922499 1
#> 2 -0.80279672 0.29105250 1
#> 3 0.10812589 -0.24085258 1
#> 4 -0.58349587 -1.99406923 1
#> 5 0.64266063 0.46982773 1
#> 6 -0.13158569 -1.01007015 1
#> 7 -1.18665411 -1.82702773 1
#> 8 -1.81740270 -0.92823009 1
#> 9 -0.13281472 0.37114234 1
#> 10 0.24658138 0.36469450 1
#> 11 -0.41681697 -0.45621893 1
#> 12 0.45719194 0.05346242 1
#> 13 -0.02601336 -0.39470408 1
#> 14 -0.40105961 0.36773807 1
#> 15 -0.79976935 0.64314954 1
#> 16 -1.72226339 -1.63401115 1
#> 17 1.21141514 -0.17180793 1
#> 18 0.70059174 1.09186556 1
#> 19 -0.23936348 0.29235286 1
#> 20 0.19283240 1.77818904 1
#> 21 0.37987042 -0.34473128 1
#> 22 -0.16465912 0.50824973 1
#> 23 -0.70092421 0.72921842 1
#> 24 0.52757687 0.29651154 1
#> 25 -0.08997147 -0.65179768 1
#> 26 4.24947155 5.60016708 2
#> 27 4.65942122 5.42423348 2
#> 28 3.57416952 6.09272660 2
#> 29 4.31759933 5.93619440 2
#> 30 4.01249583 5.94855753 2
#> 31 5.43574157 3.34223648 2
#> 32 5.21816668 4.18528342 2
#> 33 3.78183724 5.58651720 2
#> 34 4.24791902 1.91576376 2
#> 35 5.89833474 6.45890170 2
#> 36 4.58536435 3.81262547 2
#> 37 3.71594289 4.64144243 2
#> 38 5.45813562 5.64005111 2
#> 39 4.53698290 4.44726336 2
#> 40 3.29922762 2.68603494 2
#> 41 5.42280765 4.72300380 2
#> 42 6.95777099 4.46389521 2
#> 43 5.09487037 2.68471257 2
#> 44 4.75013340 5.58301679 2
#> 45 4.33029667 5.12550598 2
#> 46 4.53861245 7.04662506 2
#> 47 2.98897528 4.60623456 2
#> 48 4.99971351 4.36680498 2
#> 49 4.15981060 3.53256091 2
#> 50 5.22360088 6.19917075 2