Learn R Programming

CPC (version 2.6.2)

CPCdata.frame: Data Manipulation for CPC Calculation

Description

Converts numeric matrix to data frame with necessary format for "manual" CPC() calculation.

Usage

CPCdata.frame(data, cols, clusters)

Value

Returns a data frame with dimensions identical to those of data.

Arguments

data

a numeric n x k matrix or data frame.

cols

columns in data to be used for calculating CPC().

clusters

column in data giving cluster membership.

Examples

Run this code
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